DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Shell Scripting (http://www.daniweb.com/forums/forum113.html)
-   -   Command Menu Shell Script Help (http://www.daniweb.com/forums/thread128940.html)

dlnunez99 Jun 11th, 2008 11:23 pm
Command Menu Shell Script Help
 
I am trying to create a simple command menu that runs in a continious loop untill the user enter the exit option. I am recieving a error report that says error on line 10 syntax and unexpected end of file on line 47. Can anyone please help? I have included my script please help.

#Danny Nunez
#June 11th 2008
#Menu interface for simple commands
#This program is written to allow for users to use a command menu to complete simple tasks
#External programs that are called by this program.(user,cal,path, cd, ls -f, date, vi text editor, mails -s, exit)
exit=9
until [ "$answer" = $exit"] ; do

echo -e "\n Welcome to Danny's Main Menu \n"
echo "1 -- users"
echo "2 -- Calender for Desired Month and Year"
echo "3 -- Current Directory Path"
echo "4 -- Change Directory"
echo "5 -- Long Listing of Visible Files in the Current Directory"
echo "6 -- Current Date and Time"
echo "7 -- Start Vi editor"
echo "8 -- E-mail a file to a user"
echo "9 -- quit"
echo -e "Make your selection:\c"

read answer
echo
case "$answer" in

1) user
;;
2) cal
;;
3) path
;;
4) cd
;;
5) ls -f | more
;;
6) date
;;
7) vi
;;
8) mail -s
;;
9) exit
;;
*) echo "There is no selection:$answer"
;;
esac

Aia Jun 11th, 2008 11:55 pm
Re: Command Menu Shell Script Help
 
Missing " before $exit
until [ "$answer" = "$exit"] ; do
.
.
.
esac
done

dlnunez99 Jun 12th, 2008 12:31 am
Re: Command Menu Shell Script Help
 
I added the " as you had said to and I get the same response. Any ideas?

danny.nunez15@syccuxfs01:~> ./command_menu.sh
./command_menu.sh: line 10: unexpected EOF while looking for matching `''
./command_menu.sh: line 49: syntax error: unexpected end of file
Copy of Updated Script File

#!/bin/bash
#Danny Nunez
#June 11th 2008
#Menu interface for simple commands
#This program is written to allow for users to use a command menu to complete simple tasks
#External programs that are called by this program.(user,cal,path, cd, ls -f, date, vi text editor, mails -s, exit)
exit=9
until ["$answer"="$9"] ; do

echo Welcome to Danny's Main Menu
echo 1 -- users
echo 2 -- Calender for Desired Month and Year
echo "3 -- Current Directory Path"
echo "4 -- Change Directory"
echo "5 -- Long Listing of Visible Files in the Current Directory"
echo "6 -- Current Date and Time"
echo "7 -- Start Vi editor"
echo "8 -- E-mail a file to a user"
echo "9 -- quit"
echo -e "Make your selection:\c"

read answer
echo
case "$answer" in

1) user
;;
2) cal
;;
3) path
;;
4) cd
;;
5) ls -f | more
;;
6) date
;;
7) vi
;;
8) mail -s
;;
9) exit
;;
*) echo "There is no selection:$answer"
;;

esac

done

Aia Jun 12th, 2008 1:24 am
Re: Command Menu Shell Script Help
 
echo "Welcome to Danny's Main Menu"
echo "1 -- users"
echo "2 -- Calender for Desired Month and Year"
Missing all those quote marks.
You got to start paying attention to detail or you are not going to make it.


All times are GMT -4. The time now is 1:48 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC