Control Structures

The control flow commands alter the order of execution of commands within a shell script. The Bourne Again and Z Shells share a common syntax, whereas the TC Shell uses a different syntax (page 714). Control structures include the if…then, for…in, while, until, and case statements. In addition, the break and continue statements work in conjunction with the control flow structures to alter the order of execution of commands within a script.

if…then

The syntax of the if…then control structure is

							if test-command
							then
							commands
							fi
						

The bold words in the syntax description are the items you supply to cause the structure to have the ...

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.