Control Structures
The TC Shell uses many of the same control structures as the Bourne Again Shell. In each case the syntax is different, but the effects are the same. This section summarizes the differences between the control structures in the two shells. For more information, refer to “Control Structures” on page 626.
if
The syntax of the if control structure is
if (expression) simple-command
The if control structure works only with simple commands, not with pipes or lists of commands. You can use the if…then control structure (page 718) to execute more complex commands, such as the following:
tcsh $ cat if_1 #!/bin/tcsh # Routine to show ...
Get A Practical Guide to Red Hat® Linux® 8 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.