Difference between revisions of "Bash buildin: trap"

From wikieduonline
Jump to navigation Jump to search
 
(7 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
  trap - INT
 
  trap - INT
 
  (no output)
 
  (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 ==
 
== Related terms ==
 
* <code>[[set -e]]</code>
 
* <code>[[set -e]]</code>
 +
* <code>[[set -E]]</code>
 
* <code>[[SIGINT]], [[SIGTERM]]</code>
 
* <code>[[SIGINT]], [[SIGTERM]]</code>
 
* <code>[[return]]</code>
 
* <code>[[return]]</code>
 
* <code>[[try]]</code>
 
* <code>[[try]]</code>
 +
* <code>[[local]]</code>
  
 
== See also ==
 
== See also ==
 +
* {{trap}}
 +
* {{set}}
 
* {{Bash}}
 
* {{Bash}}
  
 
[[Category:Programming]]
 
[[Category:Programming]]

Latest revision as of 07:34, 7 February 2023

Advertising: