O'Reilly logo

A Practical Guide to Red Hat® Linux® 8 by Mark G. Sobell

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

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 ...

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