Difference between revisions of "Bash buildin: trap"
Jump to navigation
Jump to search
(Created page with "{{Draft}} == See also == * {{Bash}}") |
|||
(21 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Draft}} | {{Draft}} | ||
+ | * Man: https://man7.org/linux/man-pages/man1/trap.1p.html | ||
+ | trap - INT | ||
+ | (no output) | ||
+ | |||
+ | trap [[SIGINT]] [[EXIT]] [[SIGHUP]] [[SIGQUIT]] [[SIGTERM]] | ||
+ | |||
+ | err_report() { | ||
+ | echo "ERROR: existed with error on line $1" | ||
+ | } | ||
+ | |||
+ | trap 'err_report [[$LINENO]]' ERR | ||
+ | |||
+ | |||
+ | == Related terms == | ||
+ | * <code>[[set -e]]</code> | ||
+ | * <code>[[set -E]]</code> | ||
+ | * <code>[[SIGINT]], [[SIGTERM]]</code> | ||
+ | * <code>[[return]]</code> | ||
+ | * <code>[[try]]</code> | ||
+ | * <code>[[local]]</code> | ||
== See also == | == See also == | ||
+ | * {{trap}} | ||
+ | * {{set}} | ||
* {{Bash}} | * {{Bash}} | ||
+ | |||
+ | [[Category:Programming]] |
Latest revision as of 07:34, 7 February 2023
This article is a Draft. Help us to complete it.
trap - INT (no output)
trap SIGINT EXIT SIGHUP SIGQUIT SIGTERM
err_report() { echo "ERROR: existed with error on line $1" } trap 'err_report $LINENO' ERR
Related terms[edit]
See also[edit]
trap, wait, kill
set, unset, set -o, set -x, set -e, set +e, set -E, set +b, set -u, $?, exit, return, trap, PostgreSQL SET
Bash [ -c ]
,alias
,&&
, Bash history, Autocompletion,set
,unset
,export
,.bash_aliases, .bashrc and .bash profile
,PS1
,echo
,brace expansion
, Function,shopt
,trap
,set -e
,source
,PATH
,complete
,disown
,.hushlogin
,.bashrc
,builtin
,eval
,set
,$PATH
,$HOME
,TZ
,.profile
,-e, -i
,Builtin (Bash)
,mapfile
,~
, return (Bash), for, until,declare, dirname, basename, functions.sh
, Bash arithmetic expansion,shift, bash --rcfile, readonly, $1, $@
Advertising: