O'Reilly logo

Linux Shells by Example by Ellie Quigley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.6. Flow Control and Conditional Constructs

When making decisions, the if, if/else, if/else if/else, and switch commands are used. These commands control the flow of the program by allowing decision-making based on whether an expression is true or false.

11.6.1. Testing Expressions

An expression consists of a set of operands separated by operators. Operators are listed in Table 11.5 and Table 11.6 To test an expression, the expression is surrounded by parentheses. The TC shell evaluates the expression, resulting in either a zero or nonzero numeric value. If the result is nonzero, the expression is true; if the result is zero, the expression is false.

When evaluating an expression with the logical AND (&&), the shell evaluates from left to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required