Getting asynchronous user input in BASH
Hello
I have a BASH script running and would like to stop, without using Ctrl-C (this shuts down the entire script, which is not desired). So I need a clean exit from a running function. The bash built-in 'read' only accepts user input when prompted, and has a minimum of 1 second wait. It is not as 'clean' as I'd like ...(just hold down a key until the function execution catches up to the read ).
So here is what I would like: if the user presses a key at ANY time while a particular function is running, this key stroke would be caught and 'remembered'. The function would periodically check a variable or external event inside this loop, then do a clean exit from the function.
Any key should work, but a specific escape sequence like Ctrl-<something> would be fine.
Thanks in advance.
sed s|jake|Superjake|g
|