Hello,
I am preparing a small class for students on signals with trap. I understood the use of this principle with the example on signal 2 SIGINT:
trap "echo hello" 2: which displays "hello" each time you press the shortcut ctrl + c.
On the other hand, I have difficulty assimilating the use of the following cases:
1. The effect of signal 3 SIGQUIT.
2. The effect of siganl 9 SIGKILL.
3. The effect of the signal 19 SIGSTOP.
Can you guide me with simple examples please?
Best regard
Signals with trap
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
Signals with trap
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Signals with trap
You can find explanation of signals here: https://en.wikipedia.org/wiki/Signal_(I ... IX_signals
Ctrl+\ sends SIGQUIT. Would normally quit the process.
Ctrl+Z sends SIGSTOP. It's a job control command. Pauses the running job and returns user to the shell.
You can't trap SIGKILL or SIGSTOP in Bash I think.
Ctrl+\ sends SIGQUIT. Would normally quit the process.
Ctrl+Z sends SIGSTOP. It's a job control command. Pauses the running job and returns user to the shell.
jobs
list all jobs and fg
can be used to resume a paused job. See help jobs
and help fg
.You can't trap SIGKILL or SIGSTOP in Bash I think.