I never thought of the idea of printing out a stack trace. A logging function is an example of such a good idea that is so obvious that I didn't think of it :-)
I use -e sometimes but I really dislike scripts that rely on it for all error handling instead of handling errors and logging them.
^^ this tool has proven very useful for avoiding some of the most silly mistakes and making my scripts better. If you're maintaining scripts with other people then it is a great way of getting people to fix things without directly criticising them.
t43562•5h ago
I use -e sometimes but I really dislike scripts that rely on it for all error handling instead of handling errors and logging them.
https://www.shellcheck.net/
^^ this tool has proven very useful for avoiding some of the most silly mistakes and making my scripts better. If you're maintaining scripts with other people then it is a great way of getting people to fix things without directly criticising them.