The Unix "while loop" command

iKnow-IT banner

While loop

Long as the condition is true run commands between do and done

while condition_true 
do      
   …..      
   ….. 
done    

while expr $count \> 0 
do     
   ….     
   count=`expr $count - 1` 
done  

 

ls | while read Y 
do    
    ….      
    echo My file is: $Y 
done