Used for executing same sets of commands for a variable with multiple values.
Syntax 1:Output | while read <variable> do <commands> done
while read <variable> do <commands> done < <filename>
[root@PC1 ~]# ls anaconda-ks.cfg names.txt name.txt [root@PC1 ~]# cat names.txt Amar Kumar Shahzahan Akbar Alexendera The Great [root@PC1 ~]# cat names.txt | while read line > do > echo "$line" > done Amar Kumar Shahzahan Akbar Alexendera The Great [root@PC1 ~]# while read line > do > echo "$line" > done < names.txt Amar Kumar Shahzahan Akbar Alexendera The Great [root@PC1 ~]#