I wish I had seen this years ago, as I’ve always had a hate-hate relationship with many shells on many OS-es.
I’ve included the ToC; read the rest of BashPitfalls: common errors that Bash programmers make – Greg’s Wiki back-to-back. It’s worth it, really.
Bash Pitfalls
This page shows common errors that Bash programmers make. These examples are all flawed in some way.
You will save yourself from many of these pitfalls if you simply always use quotes and never use WordSplitting for any reason! Word splitting is a broken legacy misfeature inherited from the Bourne shell that’s stuck on by default if you don’t quote expansions. The vast majority of pitfalls are in some way related to unquoted expansions, and the ensuing word splitting and globbing that result.
Contents





