| | |
Command Menu Shell Script Help
![]() |
•
•
Join Date: Jun 2008
Posts: 2
Reputation:
Solved Threads: 0
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
#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
•
•
Join Date: Jun 2008
Posts: 2
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- Active desktop recovery/Script error (Windows NT / 2000 / XP)
- Shell program, help required. (Shell Scripting)
- Windows script need help (Computer Science)
- urllogic, downloader-va??? (Viruses, Spyware and other Nasties)
- HijackThis shows 01 entries - can't remove (Viruses, Spyware and other Nasties)
- Help i have got the coldfusion virus! (Viruses, Spyware and other Nasties)
- problem returns, please help (Viruses, Spyware and other Nasties)
Other Threads in the Shell Scripting Forum
- Previous Thread: Newbee: search for folder and add it to PATH
- Next Thread: backreferencing in sed
| Thread Tools | Search this Thread |






