Mourning the loss of our friend, WhitPhil.
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Linux and Unix
Tag Cloud
access audio black screen blue screen boot bsod connection crash dell desktop driver drivers dvd email error excel firefox hard drive hardware hijackthis internet keyboard laptop malware monitor network networking outlook problem processor recovery registry cleaner router safe mode screen slow sound spyware trojan upgrade vba video virus vista vundo windows windows 7 windows vista windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
Having some scripting issues :(

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

Closed Thread
 
Thread Tools
Lovecore's Avatar
Junior Member with 1 posts.
 
Join Date: May 2007
08-May-2007, 07: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 14,989 posts.
 
Join Date: Sep 2003
Location: -71.45091, 42.27841
10-May-2007, 06:06 AM #2
Try putting an exit after the last line.

-- Tom
Closed Thread Bookmark and Share

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.

Smart Search

Find your solution!



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


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 08:06 AM.
Copyright © 1996 - 2009 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.