Determine if F1 key is pressed in Bash script.
Posted on 2004-09-15
Hi, I'm trying to determine if a Function key (F1) has been pressed.
Using - dumpkeys - I know the key code for F1 is "\033[[A"
Now, I write a bash script like this
echo please enter the F1 function key
read -sn3 key
if [ $key == "\033[[A" ]; then
echo you pressed the F1 key
echo you pressed some other key
But this dosen't work. Can someone tell me how to do this proper.