Hey all, trying to get my homework done, but i keep getting an error. This error:
final: line 111: syntax error: unexpected end of file
Can anyone lend me a hand, or a hint? heres the script..
Code:
#!/bin/bash
#
# CSC250 - Final Project
#
initilize_variables ()
{
noinput=
user_name=' '
user_id=' '
home_dir=' '
group_id=' '
group_name=' '
#
#
cat /u/reedk/ulist|cut -f3 -d':'|sort -bg > luid_file
#
tuid=$(tail -1 luid_file)
let user_id=$tuid+1
echo "$user_id"
}
#
display_heading ()
{
clear
echo" ********************** "
echo" * ADD USER INTERFACE * "
echo" ********************** "
}
main_menu ()
{
let doption=100
while [ $doption != 99 ]
do
disply_heading
echo " 1: Enter users name: $user_name "
echo " The next available user ID is: $user_id "
echo " 2: Enter group ID number: $group_id "
echo " Group Name: $group_name "
echo " 3: Enter home Directory: $home_dir '
echo " 4: Enter Default Shell: $default_shell "
echo " "
echo " user_add -c "$user_name" -d $home_directory -g $group_id -G $group_name -m -s $defaul_shell $strt_script "
echo " "
echo " 0: ADD USER NOW "
echo " "
echo " 99: Discard new user "
echo " "
echo " What would you like to do: "
read option
case $option in
0) echo "user_add -c "$user_name" -d $home_dir -g $group_id -G $group_name -m -s $default_shell $strt_script "
echo " $user_name has been successfully added"
sleep 5
;;
1) disply_heading
echo "Please enter users name fi.mi.last: "
read confirm_data
if [ "$confirm_data" = "$noinput" ]
then
echo "No user name entered"
else
user_name = $confirm_data
home_dir = /u/$user_name
default_shell=/bin/bash
if [ "$user_name" = "$(cat /u/reedk/ulist|cut -fi -d':'|grep $user_name) " ]
then
echo " User name already exists"
fi
fi
;;
2) display_heading
echo " Enter the primary Group ID Number: "
read confirm_data
group_name=' '
if [ "$confirm_replay" = "$noinput" ]
then
echo "No group ID entered"
else
grpfnd='n'
group_id=$confirm_data
for i in in $ (cat /u/reedk/gfile|cut -fi,s -d':')
do
if [ $ (echo $i|cut -f2 -d':') -eq $group_id ]
then
grpfnd='y'
group_name=$ (echo $i|cut -fi -d':')
fi
done
if [ $grpfnd = 'n' ] || [ $group_id -eq 0 ]
then
echo " Invalid group number entered"
fi
fi
;;
99) let doption=99
;;
esac
done
}
#
################
# Main Program #
################
if [ "$(whoami)" != "$( cat /u/e.c.stolar/auth.list|grep "($whoami)" )" ]
then
echo " You are not authorized to run this script"
else
initialize_variables
main_menu
fi
Thanks so much.