Sometimes, You want to read the file content with bash programming.

There are multiple ways we can do

How to read a file by line in bash shell?

  • using while loop
#!/bin/bash
while IFS= read -r line; do
   echo "$line"
done <filename.txt