Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Linux Command Line Chapter 29

Similar presentations


Presentation on theme: "The Linux Command Line Chapter 29"— Presentation transcript:

1 The Linux Command Line Chapter 29
Flow Control: Looping With while / until Prepared by Dr. Reyes, New York City College of Technology

2 while Loop while – a command that evaluates the exit status of a list of commands, and executes the commands inside the loop as long as the exit status is zero. Stops otherwise. Syntax: while commands; do commands done

3 while Loop Example

4 Breaking Out Of A Loop break – A command that immediately terminates a loop, and makes a program control resume with the next statement following the loop. continue – A command that causes the remainder of the loop to be skipped, and program control resumes with the next iteration of the loop. These commands should seldom be used.

5 The until Command until - A command similar to the while, except that instead of exiting a loop when a nonzero exit status is encountered, it does the opposite. An until loop continues until it receives a zero exit status Syntax: until commands; do commands done

6 until Command Example


Download ppt "The Linux Command Line Chapter 29"

Similar presentations


Ads by Google