![]() (See Chapter 15, "Debugging Shell Scripts," on page 967.) Example 10.15. The –x option (called echoing) to the C/TC shell allows you to trace what is going on in your script as it executes. If one expression is false, the expression is false. It evaluates the expression on the right and if that expression is true, it becomes false, and if it is false, it becomes true. The NOT operator, !, is a unary operator. If both expressions are false, the expression is false. The OR operator, ||, evaluates the expression on the left-hand side of || if true, the expression is true if false, the expression on the right side of the || operator is tested. The AND operator, &, evaluates the expression on the left-hand side of & if true, the expression on the right side of & is tested and must also be true. The endif goes with the nearest enclosing if. The if statement may be nested as long as every single if statement is terminated with a matching endif. After the if expression is tested, and if the expression evaluates to true, the commands after the then keyword are executed until the endif is reached. The simplest form of conditional is the if statement. Logical expressions use these operators that also yield true or false: If the result is nonzero, the expression is true if the result is zero, the expression is false. ![]() The C shell evaluates the expression, resulting in either a zero or nonzero numeric value. To test an expression, the expression is surrounded by parentheses. Operators and precedence are listed in Tables 10.5 and 10.6, respectively. ![]() 10.6.1 Testing ExpressionsĪn expression consists of a set of operands separated by operators. These commands control the flow of the program by allowing decision making based on whether an expression is true or false. When making decisions, the if, if/else, if/else if, and switch commands are used. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |