Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 1
    +1 for read. So if you pipe to while read it works: cat file | while read i; do echo $i; done Commented Nov 21, 2013 at 3:36
  • 2
    @rubo except that in your example the unquoted variable is also reprocessed by the shell. Use echo "$i" to see the true effect of the read Commented Sep 9, 2015 at 19:19
  • If IFS is set to other characters, for example ,, then spaces will not be trimmed. Commented May 9, 2024 at 2:39