Read a file using a bash script

There’s no reason to use cat here — it adds no functionality and spawns an unnecessary process.

while IFS= read -r line; do
  echo "a line: $line"
done < file

To read the content of a file into a variable, use foo=$(<file).
(Note that this trims trailing newlines.)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)