Debugging Bash Like a Sire

2 gfalcao 1 7/17/2025, 12:51:28 PM blog.brujordet.no ↗

Comments (1)

t43562 · 8h ago
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.

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.