fix regression in last commit, ommiting a frame
[errhandle.git] / README
CommitLineData
acd03e1e 1Bash stack trace and error handling functions
8a786097 2
acd03e1e
IK
3Usually, just copy the err file and source it. Then on any non-zero
4return code outside of a conditional, the program will exit and print a
5stack trace.
78a1a75c 6
acd03e1e
IK
7The err file has some functions which you may want to call manually for
8different or additional error handling. See the comments at the start of
9each one.
997eb0be 10
acd03e1e
IK
11For scripts where functions are not used, you can optionally use a more
12minimal approach:
bf8b73a0
IK
13set -eE -o pipefail
14trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
8a786097 15
acd03e1e
IK
16In the above line, cleanup commands or functions can be appended to the
17ERR trap after a semicolon within the single quotes.
d52bee6b 18
4e4793ff 19Related: see my bash script template repo, at https://iankelling.org/git.
bf8b73a0 20
276299a5
IK
21Please email me if you have a patches, bugs, feedback, or republish this
22somewhere else: Ian Kelling <ian@iankelling.org>.