mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
8a97bffd02
darcs-hash:20060824103055-ac50b-8a81c73571b76dd2800787ca6e5bd29787eb9501.gz
37 lines
1.4 KiB
Text
37 lines
1.4 KiB
Text
|
|
\section trap trap - perform an action when the shell receives a signal
|
|
|
|
\subsection trap-synopsis Synopsis
|
|
<tt>trap [OPTIONS] [[ARG] SIGSPEC ... ]</tt>
|
|
|
|
\subsection trap-description Description
|
|
|
|
Trap is a shellscript wrapper around the fish event delivery
|
|
framework. It exists for backwards compatibility with Posix
|
|
shells. For other uses, it is recommended to define a <a
|
|
href='index.html#event'>event handler</a>.
|
|
|
|
- ARG is the command to be executed on signal delivery
|
|
- SIGSPEC is the name of the signal to trap
|
|
- \c -h or \c --help Display help and exit
|
|
- \c -l or \c --list-signals print a list of signal names
|
|
- \c -p or \c --print print all defined signal handlers
|
|
|
|
If ARG and SIGSPEC are both specified, ARG is the command to be
|
|
executed when the signal specified by SIGSPEC is delivered.
|
|
|
|
If ARG is absent (and there is a single SIGSPEC) or -, each specified
|
|
signal is reset to its original disposition (the value it had upon
|
|
entrance to the shell). If ARG is the null string the signal
|
|
specified by each SIGSPEC is ignored by the shell and by the commands
|
|
it invokes.
|
|
|
|
If ARG is not present and -p has been supplied, then the trap commands
|
|
associated with each SIGSPEC are displayed. If no arguments are
|
|
supplied or if only -p is given, trap prints the list of commands
|
|
associated with each signal.
|
|
|
|
Signal names are case insensitive and the SIG prefix is optional.
|
|
|
|
The return status is 1 if any SIGSPEC is invalid; otherwise trap
|
|
returns 0.
|