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

Recommended Answers

All 3 Replies

Missing " before $exit
until [ "$answer" = "$exit"] ; do
.
.
.
esac
done

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.