Alright... I think I figured out bow to init my variables. Below is the complete add user script I am trying to make work.
line 53: syntax error near unexpected token `0' (RED)
*******************************************************************************************************************************************
#!/bin/bash
#
# complete add user script
#
initialize_variables ()
{
noinput=
user_name=' '
user_id_num=' '
home_directory=' '
group_id_num=' '
group_name=' '
#
#
cat /u/reedk/ulist|cut -f3 -d':'|sort -bg > luid_file
#
tuid=$(tail -1 luid_file)
let user_id_num=$tuid+1
echo "$user_id_num"
}
#
display_heading ()
{
clear
echo " ADD USER SCREEN "
echo " _________________________________"
}
main_menu ()
{
let doption=100
while [ $doption != 99 ]
do
display_heading
echo " 1. Enter user real name .................. $user_name "
echo " Next available user ID Number ......... $user_id_num "
echo " 2. Enter Group ID Number ................. $group_id_num "
echo " Group name .....$group_name"
echo " 3. Enter Home Directory ................. $home_directory "
echo " 4. Enter Default Shell .................. $default_shell "
echo " "
echo " user_add -c "$user_name" -d $home_directory -g $group_id_num -G $group_name -m -s $default_shell $strt_script "
echo " "
echo " 0. ADD USER NOW "
echo " "
echo " "
echo " 99. EXIT (Take no action) "
echo " ============================================================"
echo " Please select an option ===> "
read option
case $option in
0) echo " user_add -c "$user_name" -d $home_directory -g $group_id_num -G $group_name -m -s $default_shell $strt_script "
echo " $user_name has been added successfully"
sleep 5
;;
1) display_heading
echo "Please the users real name: (fi.mi.last) ==> "
read confirm_reply
if [ "$confirm_reply" = "$noinput" ]
then
echo " No user name entered"
else
user_name=$confirm_reply
home_directory=/u/$user_name
default_shell=/bin/bash
if [ "$user_name" = "$( cat /u/reedk/ulist|cut -f1 -d':'|grep $user_name) " ]
then
echo " User name already exists"
fi
fi
;;
2) display_heading
echo "Enter the primary Group ID Number ==> "
read confirm_reply
group_name=' '
if [ "$confirm_reply" = "$noinput" ]
then
echo "No primary group ID was entered"
else
grpfnd='n'
group_id_num=$confirm_reply
for i in $(cat /u/reedk/gfile|cut -f1,3 -d':')
do
if [ $(echo $i|cut -f2 -d':') -eq $group_id_num ]
then
grpfnd='y'
group_name=$(echo $i|cut -f1 -d':')
fi
done
if [ $grpfnd = 'n' ] || [ $group_id_num -eq 0 ]
then
echo "Invalid primary group number entered"
fi
fi
;;
99) let doption=99
;;
esac
done
}
#
###################################
# BEGIN MAIN PROGRAM #
###################################
if [ "$(whoami)" != "$( cat /u/reedk/auth.list|grep $(whoami) )" ]
then
echo " You are not authorized to run this script ... Contact your System Administrator "
else
initialize_variables
main_menu
fi