Using Shell Constructs
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.
Conditional Constructs: The if Statement
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 ...
Get Practical Linux now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.