Happy 32nd birthday, Bash!
The Bourne-again Shell, default in the vast majority of Linux distributions, turned 32 yesterday! Can you imagine your life in Linux without it?
I certainly can't, as it was the first shell I used when I first started using Linux, and definitely the reason why I learned how to not be discouraged from using the command-line, but actually be motivated every day to learn more about it, and how powerful it could be, if you just learned how to use it.
In celebration, here's a nice Reddit thread where people share some very nice tips and tricks for working with bash. I learned lots of new things from that thread, but in particular, the following will be very helpful when developing new scripts:
set -e
: makes bash exit on the first error rather than carrying it forward. This makes it closer in behavior to other programming languages.set -u
: makes bash exit if some variable is undefined, rather than interpret it as an empty string. Again, makes it much more like a programming language.
What are some of your favorite bash tips? Let me know replying on my Mastodon post! Happy Birthday, Bash, and soon it will be Linux's!