I’ve seen several articles in the past with titles like “Top 10 things you didn’t know about bash programming.” These articles are disappointing on two levels: first of all, the tricks are almost always things I already knew. And secondly, if you want to write portable programs, you can’t depend on bash features (not every platform has bash!). POSIX-like shells, however, are much more widespread.
Since writing redo, I’ve had a chance to start writing a few more shell scripts that aim for maximum portability, and from there, I’ve learned some really cool tricks that I haven’t seen documented elsewhere. Here are a few.