Jump to content

While loop

From Squishu Wiki

General

Syntax

while condition do
  statements
done

Examples

echo "Enter password"
read trythis

while [ "$trythis" != "secret" ]; do
  echo "Sorry, try again"
  read trythis
done