I wrote a bash script, which has "buttons" similar to "mc" or Norton Commander. Right now, I use the number keys (1-0) to simulate the buttons being pressed. However, I would rather have the F-keys (F1-F10) to do it.
I saw this question and answers, but I am not certain this can be used in a script to trigger a function (e.g. by using "read").
Does bash support it? If so, is there a fairly easy way to implement it?
UPDATE
The script is kind of a dash, which needs to be refreshed in order to keep the contents current. However, at the same time I would like to keep the "channel" open to allow user input (therefore sleep
would not be adequate).
The read line currently in use to get the user input looks like this:
read -n 1 -s -t "${iRefresh}" sReturnVar
.
Here "iRefresh" is set to 2 seconds in order to time out when no input is given to refresh the display and return to the read line thereafter. In essence the read line doubles as a content refresher while waiting for user input.