Process lines safely using while-read.
Section: Conditionals Loops and Functions
Read file line by line
bash
bash
while IFS= read -r line; do echo "$line"; done < input.txtExplanation
Preferred pattern for preserving whitespace and backslashes.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Conditionals Loops and Functions