Select Page

How to loop through lines in a file using Bash

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

Leave a reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.