I have wrote a shell script in which I would like to include the functionality to exit the program by pressing the q key. Can I do that?
Here is what I currently have:
#!/bin/ksh
echo "Press Q to exit \t\t:\c"
read input
if [[ $input = "q" ]] || [[ $input = "Q" ]]
then exit 1
else
echo "Invalid Input."
fi