/usr/share/zsh/5.5.1/help
NameSizeModeActions
alias23220644editdlrm
autoload46090644editdlrm
bg1230644editdlrm
bindkey600644editdlrm
break1840644editdlrm
builtin810644editdlrm
bye5310644editdlrm
cap620644editdlrm
cd27190644editdlrm
chdir27190644editdlrm
clone640644editdlrm
colon1900644editdlrm
command5660644editdlrm
comparguments810644editdlrm
compcall750644editdlrm
compctl740644editdlrm
compdescribe800644editdlrm
compfiles770644editdlrm
compgroups780644editdlrm
compquote770644editdlrm
comptags760644editdlrm
comptry750644editdlrm
compvalues780644editdlrm
continue2440644editdlrm
declare214120644editdlrm
dirs7290644editdlrm
disable37670644editdlrm
disown6820644editdlrm
dot11440644editdlrm
echo14700644editdlrm
echotc660644editdlrm
echoti670644editdlrm
emulate65620644editdlrm
enable12620644editdlrm
eval3740644editdlrm
exec9970644editdlrm
exit5310644editdlrm
export2800644editdlrm
false680644editdlrm
fc62190644editdlrm
fg1400644editdlrm
float214120644editdlrm
functions37680644editdlrm
getcap620644editdlrm
getln1470644editdlrm
getopts18400644editdlrm
hash24430644editdlrm
history62190644editdlrm
integer214120644editdlrm
jobs7910644editdlrm
kill14800644editdlrm
let3230644editdlrm
limit35980644editdlrm
local214120644editdlrm
log1160644editdlrm
logout5310644editdlrm
noglob830644editdlrm
popd8200644editdlrm
print54150644editdlrm
printf21530644editdlrm
pushd16260644editdlrm
pushln54150644editdlrm
pwd2600644editdlrm
r62190644editdlrm
read58140644editdlrm
readonly214120644editdlrm
rehash24430644editdlrm
return9280644editdlrm
sched640644editdlrm
set24660644editdlrm
setcap620644editdlrm
setopt15990644editdlrm
shift4220644editdlrm
source1820644editdlrm
stat630644editdlrm
suspend1990644editdlrm
test12120644editdlrm
times1130644editdlrm
trap37040644editdlrm
true670644editdlrm
ttyctl12190644editdlrm
type23930644editdlrm
typeset214120644editdlrm
ulimit31730644editdlrm
umask4850644editdlrm
unalias12820644editdlrm
unfunction12820644editdlrm
unhash12820644editdlrm
unlimit5550644editdlrm
unset9330644editdlrm
unsetopt5060644editdlrm
vared520644editdlrm
wait13780644editdlrm
whence23930644editdlrm
where23930644editdlrm
which23930644editdlrm
zcompile66290644editdlrm
zformat720644editdlrm
zftp630644editdlrm
zle520644editdlrm
zmodload173370644editdlrm
zparseopts750644editdlrm
zprof640644editdlrm
zpty630644editdlrm
zregexparse760644editdlrm
zsocket770644editdlrm
zstyle640644editdlrm
ztcp660644editdlrm
Edit: /usr/share/zsh/5.5.1/help/trap (3704B)
trap [ arg ] [ sig ... ] arg is a series of commands (usually quoted to protect it from immediate evaluation by the shell) to be read and executed when the shell receives any of the signals specified by one or more sig args. Each sig can be given as a number, or as the name of a signal either with or without the string SIG in front (e.g. 1, HUP, and SIGHUP are all the same signal). If arg is `-', then the specified signals are reset to their defaults, or, if no sig args are present, all traps are reset. If arg is an empty string, then the specified signals are ignored by the shell (and by the commands it invokes). If arg is omitted but one or more sig args are provided (i.e. the first argument is a valid signal number or name), the effect is the same as if arg had been specified as `-'. The trap command with no arguments prints a list of commands associated with each signal. If sig is ZERR then arg will be executed after each command with a nonzero exit status. ERR is an alias for ZERR on systems that have no SIGERR signal (this is the usual case). If sig is DEBUG then arg will be executed before each command if the option DEBUG_BEFORE_CMD is set (as it is by default), else after each command. Here, a `command' is what is described as a `sublist' in the shell grammar, see the section SIMPLE COMMANDS & PIPELINES in zshmisc(1). If DEBUG_BEFORE_CMD is set various additional features are available. First, it is possible to skip the next command by setting the option ERR_EXIT; see the description of the ERR_EXIT option in zshoptions(1). Also, the shell parameter ZSH_DEBUG_CMD is set to the string corresponding to the command to be executed following the trap. Note that this string is reconstructed from the internal format and may not be formatted the same way as the original text. The parame- ter is unset after the trap is executed. If sig is 0 or EXIT and the trap statement is executed inside the body of a function, then the command arg is executed after the function completes. The value of $? at the start of execu- tion is the exit status of the shell or the return status of the function exiting. If sig is 0 or EXIT and the trap statement is not executed inside the body of a function, then the command arg is executed when the shell terminates; the trap runs before any zshexit hook functions. ZERR, DEBUG, and EXIT traps are not executed inside other traps. ZERR and DEBUG traps are kept within subshells, while other traps are reset. Note that traps defined with the trap builtin are slightly dif- ferent from those defined as `TRAPNAL () { ... }', as the latter have their own function environment (line numbers, local vari- ables, etc.) while the former use the environment of the command in which they were called. For example, trap 'print $LINENO' DEBUG will print the line number of a command executed after it has run, while TRAPDEBUG() { print $LINENO; } will always print the number zero. Alternative signal names are allowed as described under kill above. Defining a trap under either name causes any trap under an alternative name to be removed. However, it is recommended that for consistency users stick exclusively to one name or another.