Home » Until Loop Shell Scripting

Until Loop Shell Scripting

by Online Tutorials Library

Shell Scripting until loop

It is similar to while loop. The only difference is that until statement executes its code block while its conditional expression is false, and while statement executes its code block while its conditional expression is true.


Difference between while and until

Until loop always executes at least once. Loop while executes till it returns a zero value and until loop executes till it returns non-zero value.

Syntax:

Syntax of until loop is shown in the snapshot below:

Linux Shell Scripting Until loop 1

Example:

We have shown an example to display number from 5 to 15.

Linux Shell Scripting Until loop 2

Look at the above snapshot, it shows the script.

Linux Shell Scripting Until loop 3

Look at the above snapshot, it displays the output until the condition is false.

Next TopicShell Functions

You may also like