Ok I know I’ve asked a similar question, I understand how to do an infinate loop:
while [ 1 ]
do
foo
bar
then
sleep 10
done
But if I want to run some (quite a few) IF ELSE Statements in this loop how would I get the script to carry on looping once they had completed how would I go about this?
while trueor using true’s shorter alias:.[ 1 ]is needlessly complicated and is not what you think it is ([ 0 ]is also true!). Remember, the condition inifandwhileis arbitrary command whose exit status (zero = true, nonzero = false) is used as the condition value and[is just alias for specialtestcommand (both built-in in most shells, but they don’t have to be).do/doneincluding conditionals, more loops and cases.breakto terminate innermost loop from inside (just like most other languages).