Advanced Bash-Scripting Guide: A complete guide to shell scripting, using Bash | ||
---|---|---|
Prev | Chapter 7. Tests | Next |
Condition tests using the if/then construct may be nested. The net result is identical to using the && compound comparison operator above.
if [ condition1 ] then if [ condition2 ] then do-something # But only if both "condition1" and "condition2" valid. fi fi |
See Example 35-3 for an example of nested if/then condition tests.