Command Menu Shell Script Help

Reply

Join Date: Jun 2008
Posts: 2
Reputation: dlnunez99 is an unknown quantity at this point 
Solved Threads: 0
dlnunez99 dlnunez99 is offline Offline
Newbie Poster

Command Menu Shell Script Help

 
0
  #1
Jun 11th, 2008
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 selectionanswer"
;;
esac
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,033
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 177
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: Command Menu Shell Script Help

 
0
  #2
Jun 11th, 2008
Missing " before $exit
until [ "$answer" = "$exit"] ; do
.
.
.
esac
done
Last edited by Aia; Jun 11th, 2008 at 11:56 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 2
Reputation: dlnunez99 is an unknown quantity at this point 
Solved Threads: 0
dlnunez99 dlnunez99 is offline Offline
Newbie Poster

Re: Command Menu Shell Script Help

 
0
  #3
Jun 12th, 2008
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 selectionanswer"
;;

esac

done
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,033
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 177
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: Command Menu Shell Script Help

 
0
  #4
Jun 12th, 2008
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC