-The main usage documentation is near the top of any bash script files which sit
-next to this file.
+Bash stack trace and error handling functions
-Files ending in -function are for sourcing then calling as a function. Files
-without -function are exactly the same except they are for calling as a script.
+Usually, just copy the err file and source it. Then on any non-zero
+return code outside of a conditional, the program will exit and print a
+stack trace.
-Patches and bugs are very welcome via gitlab.
+The err file has some functions which you may want to call manually for
+different or additional error handling. See the comments at the start of
+each one.
-Questions, feedback, etc are very welcome via email to Ian Kelling
-<ian@iankelling.org>. I will add any useful questions, answers, etc. to this
-file. The scope/userbase of this project doesn't justify a mailing list, but if
-it ever did I would start a discourse instance category to act as a mailing list
-and forum.
+For scripts where functions are not used, you can optionally use a more
+minimal approach:
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
-This program is also part of a collection of programs,
-https://gitlab.com/iankelling/bash-programs-by-ian, which are unrelated except
-having the same author and being being bash programs.
+In the above line, cleanup commands or functions can be appended to the
+ERR trap after a semicolon within the single quotes.
+
+Related: see my bash script template repo, at https://iankelling.org/git.
+
+Please email me if you have a patches, bugs, feedback, or republish this
+somewhere else: Ian Kelling <ian@iankelling.org>.