Expressions
Expressions are used in @ (the C shell math operator), if, and while statements to perform arithmetic , string comparisons, file testing, and so on. exit and set also specify expressions , as can the tcsh built-in command filetest. Expressions are formed by combining variables and constants with operators that resemble those in the C programming language. Operator precedence is the same as in C. It is easiest to just remember the following precedence rules:
* / %
+ -
Group all other expressions inside
()
s; parentheses are required if the expression contains<
,>
,&
, or|
Get Unix in a Nutshell, 4th Edition 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.