Question: 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
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($ARVG[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 to the system"
exit 2
fi
* recheck the code if this is valid syntax for account management or suggest /do another user account management shell script that runs in unix terminal and please attache the output at the end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
