I want to check if the user has not entered 'y' or 'n' and if not then to keep looping asking the user to entered the correct letter but it is not working... the code below shows what I have tried so far ....can someone help me please???
echo "Enter 'y' to exit or 'n' to continue"
echo -n "Do you want to exit? "
read character
while [ "$character" != "y" || "$character" != "n" ];
do
echo -n "Wrong key re-enter 'y' to exit or 'n' to continue"
read character
done
$var != y || $var != nis always true. Anything that isn'tywill make the first part true andywill make the second part true.$varis notxOR noty? Or do you want$varis notxAND noty?