Bash Shell Scripting

How to loop through lines in a file using Bash

Written by Ian Carnaghan · 6 sec read >
for i in $(cat myFile.txt); do echo $i; done

The above code executes a for loop and then echo’s out each line in the file myFile.txt

Last Updated On April 07, 2018
Written by Ian Carnaghan
I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment. Profile

Leave a Reply

avatar
  Subscribe  
Notify of