On-line Guides

How To Guides






Advanced Bash-Scripting Guide:
Prev Chapter 7. TestsNext

7.4. Nested if/then Condition Tests

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 34-4 for an example of nested if/then condition tests.


Prev Home Next
Other Comparison OperatorsUp Testing Your Knowledge of Tests
Published under the terms of the GNU General Public License Design by Interspire

AltStyle によって変換されたページ (->オリジナル) /