I have the following code snippet:
echo '(y for yes, n for no, any other key to cancel)'
if [ $tmp = "y" ]; then
echo "you typed 'yes'"
elif [ $tmp = "n" ]; then
elif [ $tmp = "c" ]; then
If I run this script and instead of typing any 'normal' key press <enter> the I get an error message:
./test.sh: line 6: [: =: unary operator expected
./test.sh: line 8: [: =: unary operator expected
./test.sh: line 10: [: =: unary operator expected
How can I get the script to react to <enter> the same way as to any key (except of course 'y', 'n' and 'c')?