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:
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
}
The problem is that when the script is run I get the following error message back:
./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" ]]'
So, the issue I am having is how can I run the loop of the manu menu as my function is intended to provide?
Thanks for the time.