There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Tag Cloud
access acer asus bios bsod computer crash driver drivers error ethernet excel freeze gaming google gpu hard drive hardware hdmi internet laptop malware memory missing monitor motherboard network operating system printer problem ram registry router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
Having some scripting issues :(

Reply  
Thread Tools
Lovecore's Avatar
Junior Member with 1 posts.
 
Join Date: May 2007
08-May-2007, 08:36 PM #1
Having some scripting issues :(
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.
lotuseclat79's Avatar
Distinguished Member with 21,345 posts.
 
Join Date: Sep 2003
Location: -71.45091, 42.27841
10-May-2007, 07:06 AM #2
Try putting an exit after the last line.

-- Tom
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:52 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.