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 ...
Get Linux Shells by Example 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.