how to stop a bash script by pressing a key?
Hi i want to know how to stop this loop by pressing a key, and if possible how to start it again with a keystroke.
Code:
#!/bin/bash |
Ctrl+Z will stop the process. You can resume it by using the fg command.
In general, a process can be stopped and resumed by sending the SIGSTOP and SIGCONT signals to the process. |
naw dude. it doesnt work
|
Yes it does. Unless the xdotool is intercepting signals and ignoring them, which is always possible. IIRC, Ctrl+Z sends SIGTSTP which can be caught by a process and thus ignored, whereas SIGSTOP cannot be caught by a process.
|
okay so how to i code for it to send sigstop by pressing a key?
|
you can use the command stty -a to check how it is set.
you will get something like this: Code:
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = M-^?; start = ^Q; Code:
susp CHAR |
Try CTRL-C.
|
All times are GMT -5. The time now is 10:36 PM. |