Plurrrr

Tue 02 Mar 2021

Elegant bash conditionals

The if-statement is a very basic thing, not just in bash, but in all of programming. I see them used quite a lot in shell scripts, even though in many cases they can be replaced with something much more elegant.

In this rather short article, I'll show how control operators can be used instead. Many probably know about this, but don't realize how to use them nicely. This will help you write cleaner shell scripts in the future.

Source: Elegant bash conditionals, an article by Tim Visée.