Infinite loop in bash

An infinite loop is a sequence of instructions which loops endlessly, either due to the loop having no terminating condition, having one that can never be met, or one that causes the loop to start over.  We can use ':' special command with while loop to tests or set an infinite loop or an endless loop.

The format should like as below.

while :
do
       if cond1
       then
       command
       else
       break
       fi
done

 

Leave a Reply

Your email address will not be published. Required fields are marked *