Linux until and while

Updated: 04/26/2017 by Computer Hope

About until and while

Shell built-in functions to repetitively execute a set of actions while/until conditions are evaluated TRUE.

until and while syntax

while [ conditions ] ; do actions ; done
until [ conditions ] ; do actions ; done

until and while examples

while [ $filename ]
echo "file?"
read filename # read from terminal find . -name $filename -print

User is repeated prompted for a name of a file to be located, until the user chooses to finish execution.

break — Break out of a while, for, foreach, or until loop.
csh — The C shell command interpreter.
ksh — The Korn shell command interpreter.
sh — The Bourne shell command interpreter.