-
The problem statement, all variables and given/known data:
My problem is an infinite loop when i press any other key other then Y or y in the while loop. what i want it to do is return to the normal script outside of it if pressing N or n or keep asking the same question if its any other button. Perhaps my knowledge and understanding of loops is inaccurate. But i have made it very similar to the lecture shown ones and it isnt working out very well. Thanks in advance. -
Relevant commands, code, scripts, algorithms:
P.S. I am using cygwin in windows to do this script.
- The attempts at a solution (include all code and scripts):
"4")
clear
echo Would you like to exit? [y/n]?
read answer
while [ "$answer" != "Y" ] || [ "$answer" != "y" ]; do
case "$answer" in
"Y" | "y") clear; exit ;;
"N" | "n")
echo Press enter to continue
read a ;;
*)
echo Invalid input
echo Press enter to continue...
read a
;;
esac
if [ $answer != "Y" ] || [ "$answer" != "y" ]; then
echo "Press enter to continue..."
read A
fi
done
;;
- Insearch: (University of Technology Sydney), Sydney NSW, Australia, James Hu (web systems), www(dot)insearch.edu.au/default.aspx?ArticleID=430
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).