bash provides the following constructs:
Conditional constructs—These are statements that cause code to be executed depending on a decision.
Looping constructs—These are statements that repeat the themselves a given number of times.
As stated before, this chapter is not intended to teach you how to program, only to introduce you to the most commonly used parts of shell programming so that if you're confronted with a shell script, you'll be able to figure out what's happening.
The if statement executes lines of code depending on whether the expression following the keyword if evaluates to a true result. The code following the else keyword (if any) is executed if the expression evaluates ...