first time asking a question here and still learning bash, so bear with me.
I made a main screen using while and case, it was supposed to work but it's not and I don't know where I made a mistake.
while [ $WH!=5 ]
do
echo "Choice menu:"
echo " 1) Option 1"
echo " 2) Option 2"
echo " 3) Option 3"
echo " 4) Option 4"
echo " 5) End script"
echo -n "Choose an option: "
read $OP
case $OP in
1)
# code;;
2)
# more code;;
3)
# more code;;
4)
# even more code;;
5)
echo "Thank you for testing this script!"
$WH=5;;
esac
done
No matter what I put in $OP, the script keeps repeating the choice menu until I cancel it. I tried moving while and using $OP as the condition, but nothing seemed to work.
read OP, notread $OP.whilecondition is incorrect, too (needs spaces around!=) - shellcheck.net will tell you things like that.selectstatement to build simple menus like this.$WH=5byWH=5and!"by"!andread $OPbyread OP.