![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bash : how do i check the user input and make sure is only chracter or only number ? | CheeSen | Shell Programming and Scripting | 7 | 09-07-2008 07:06 AM |
| Bash - Add User script | niels.intl | Shell Programming and Scripting | 4 | 05-10-2008 10:24 PM |
| Problem setting up Bash user account | sumanroyc | UNIX for Advanced & Expert Users | 2 | 10-27-2006 05:57 PM |
| Drop down menu in bash for timezone select | simonb | Shell Programming and Scripting | 1 | 04-29-2006 01:02 PM |
| Help with Flat Files Please!! BASH (New User) | cyberjax21 | Shell Programming and Scripting | 0 | 02-27-2006 09:19 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Presenting the user a menu in Bash ...
Hello,
I am trying to write a bash script function to present the user a menu of options. The following is what I have so far: Code:
function MainMenu {
while [[ "$USR_CHOICE" !== "4" || "$USR_CHOICE" !== "four" || "$USR_CHOICE" !== "Four" ]]
do
echo "--------------------------------------------------------------------------------"
echo "-----------------------------------Main Menu------------------------------------"
echo "--------------------------------------------------------------------------------"
echo "Select from the following options:"
echo "----------------------------------"
echo ""
echo " 1. Option One"
echo " 2. Option Two"
echo " 3. Option Three"
echo " 4. Exit"
echo ""
read -r -p "Type in the desired option: " USR_CHOICE
case $USR_CHOICE in
1|"1"|one|One)
;;
2|"2"|two|Two)
;;
3|"3"|three|Three)
;;
4|"4"|four|Four)
;;
*)
#Error occured in script
;;
esac
done
}
Code:
./deploy.sh: line 14: conditional binary operator expected ./deploy.sh: line 14: syntax error near `!==' ./deploy.sh: line 14: ` while [[ "$USR_CHOICE" !== "4" || "$USR_CHOICE" !== "four" || "$USR_CHOICE" !== "Four" ]]' Thanks for the time. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|