Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #useradd script
- DECISION=yes
- while [ "$DECISION" = 'yes' ]; do
- echo Please Enter First Name
- read FNAME
- echo Please Enter Last Name
- read LNAME
- #variables for comment field
- UFNAME=`echo $FNAME | cut -c 1 | tr [:lower:] [:upper:]`
- LFNAME=`echo $FNAME | cut -c 2- | tr [:upper:] [:lower:]`
- ULNAME=`echo $LNAME | cut -c 1 | tr [:lower:] [:upper:]`
- LLNAME=`echo $LNAME | cut -c 2- | tr [:upper:] [:lower:]`
- #variables for username
- USRNM=`echo $LNAME$FNAME | tr [:upper:] [:lower:]`
- echo Please Enter Department
- read DEPT
- #variable for naming department
- NDEPT=`echo $DEPT | cut -c -4 | tr [:upper:] [:lower:]`
- groupadd $NDEPT
- useradd -c "$ULNAME$LLNAME, $UFNAME$LFNAME" -g $NDEPT -G users $USRNM
- echo 123456 | passwd --stdin $USRNM
- echo "Would you like to add another user?(yes/no)"
- read YESNO
- DECISION=`echo $YESNO | tr [:upper:] [:lower:]`
- DONE
- LOOP=1
- while [ "$DONELOOP" -eq "1" ] do
- if [ $DECISION == "yes" ]; then
- DECISION=yes
- DONE
- LOOP=2
- elif [ "$DECISION" == "no" ]; then
- echo "Thank you for using this program"
- DONE
- LOOP=2
- else
- echo "Please use a correct option. (yes/no)"
- read YESNO
- DECISION=`echo $YESNO | tr [:upper:] [:lower:]`
- fi
- done
- done
Advertisement
Add Comment
Please, Sign In to add comment