Loop to read a file line by line in terminal

Post date: Jul 5, 2016 9:21:15 PM

This is the example I used from read-a-file-line-by-line-assigning-the-value-to-a-variable:

#!/bin/bash while IFS='' read -r line || [[ -n "$line" ]]; do     echo "Text read from file: $line" done < "$1"

Refer to this article for loop in terminal:

Loops for, while and until