All non-trivial Bash scripts need to make decisions. The Bash if statement lets your Linux script ask questions and, depending on the answer, run different sections of code. Here’s how they work.
If a Linux Bash script relies on certain files or directories being present, it can’t just assume they do. It needs to check that they’re definitely present. Here’s how to do that.