Skip to content

Instantly share code, notes, and snippets.

@ksred
Created January 23, 2014 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksred/8576872 to your computer and use it in GitHub Desktop.
Save ksred/8576872 to your computer and use it in GitHub Desktop.
Basic example to show usage of infinite while loop and string based if statement
#! /bin/bash
echo “Are you ready to begin? (y/n)”
read READY
while :
do
if [ “$READY” == “n” ]
then
echo “Are you ready now?”
read READY
else
echo “Then let's begin!”
break #breaks out of the infinite while loop
fi #end if statement
done #end while loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment