common/*: update pages of some POSIX special built-in utilities (#11956)
* exec, export, readonly, set, shift, trap: replace command descriptions * exec, exit, export, readonly, set, shift, trap, exec, export: replace example descriptions * exec, trap: replace "More information" links * trap: remove prefix "SIG" from some command arguments Although POSIX allows implementations to specify signal names without the prefix "SIG", I will choose the most portable form. * export: replace term Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> * set: replace term Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> * export: replace term Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> * export: replace term Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> * exec: replace Open Group link Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> * exit: replace Open Group link Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> * export: replace Open Group link Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> * readonly: replace Open Group link Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> * set: replace Open Group link Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> * shift: replace Open Group link Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> * trap: replace Open Group link Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> * exec: explain environment of child process Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> --------- Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com>
This commit is contained in:

committed by
GitHub

parent
8f4a2aeb27
commit
0385654986
@@ -1,21 +1,20 @@
|
||||
# trap
|
||||
|
||||
> Automatically execute commands after receiving signals by processes or the operating system.
|
||||
> Can be used to perform cleanups for interruptions by the user or other actions.
|
||||
> More information: <https://manned.org/trap>.
|
||||
> Execute a command upon an event.
|
||||
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-trap>.
|
||||
|
||||
- List available signals to set traps for:
|
||||
- List the available event names (e.g. `SIGWINCH`):
|
||||
|
||||
`trap -l`
|
||||
|
||||
- List active traps for the current shell:
|
||||
- List the commands and the names of the expected events:
|
||||
|
||||
`trap -p`
|
||||
|
||||
- Set a trap to execute commands when one or more signals are detected:
|
||||
- Execute a command when a signal is received:
|
||||
|
||||
`trap 'echo "Caught signal {{SIGHUP}}"' {{SIGHUP}}`
|
||||
|
||||
- Remove active traps:
|
||||
- Remove commands:
|
||||
|
||||
`trap - {{SIGHUP}} {{SIGINT}}`
|
||||
|
Reference in New Issue
Block a user