I’m running a few operations using shell scripting. I’m looking for a piece of code that will do the following.
Whenever the key x is pressed, the script should be terminated, and whenever the key m is pressed, it should go back to the main menu. (There is a function to invoke the main menu, so whenever m is pressed, it should call that function).
These keys x and m should work at all times, ie even if I’m halfway thru the execution, if i press the key x, the script should immediately be terminated. Is there any possible way to implement this?
P.S. : It would be better if a key combination is used, Eg. ctrl+x for exit and ctrl+m for main menu