“Linux C Compiler online” Code-Antworten

Onlne Compiler C Linux

gcc filename.c -o./ hello
Vast Vole

Linux C Compiler online

$ gcc client.c -o client -lpthread
Ravi Kumar

Linux C Compiler online

#!/bin/bash
# Purpose - Script to add a user to Linux system including passsword
# Author - Vivek Gite <www.cyberciti.biz> under GPL v2.0+
# ------------------------------------------------------------------
# Am i Root user?
if [ $(id -u) -eq 0 ]; then
	read -p "Enter username : " username
	read -s -p "Enter password : " password
	egrep "^$username" /etc/passwd >/dev/null
	if [ $? -eq 0 ]; then
		echo "$username exists!"
		exit 1
	else
		pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
		useradd -m -p "$pass" "$username"
		[ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!"
	fi
else
	echo "Only root may add a user to the system."
	exit 2
fi
SNEHAL ASHTEKAR

Ähnliche Antworten wie “Linux C Compiler online”

Fragen ähnlich wie “Linux C Compiler online”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen