The Friendly Coder

On software development and technology

BASH error handling

I have been spending a lot more time lately working in Linux environments, which has afforded me with an opportunity to learn more about the Bourne Again Shell and it’s scripting environment. One thing I found somewhat tedious and difficult to figure out was how to effectively do BASH error handling in shell scripts. I’ve summarized several gotchas I encountered as well as several patterns that seem to work quite well.