Hey I'm trying to run the following script. But  the program is not running
after the initial input stage:

#!/bin/bash

if [[ $UID != 0 ]]
then
 exit 1
fi

if [[ $?=0 ]]
then
 read -p 'Enter the new username' $user_name
 read -p 'Enter Real name' $comment
 read -p 'Enter password' $password
 exit 0
else
 exit 1
fi

#create account - The code is not running from here
if [[ "$?" -eq  0 ]]
then
 useradd -c $comment -m $user_name
 echo $password | pwrd --stdin ${user_name}
 echo Working...
 exit 0
fi

if [[ $? == 0 ]]
then
 echo "Account Created" "Username: ${user_name}, Host: ${HOSTNAME}"

Thanks team.

Reply via email to