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
  • When the last line doesn't have a trailing \n, the while loop exits, because although it read the last line, it also returns a non-zero exit code to indicate EOF... to get around it, the following snippet works (..It has been been bugging me for a while, and I've just discovered this workaroung)... eof=false; IFS=; until $eof; do read -r || eof=true; echo "$REPLY"; done Commented Aug 15, 2011 at 21:42
  • @Gilles: you added a trailing / that is not needed in bash. It is a ksh requirement? Commented Aug 16, 2011 at 7:35
  • 1
    The trailing / is needed in older versions of ksh, and IIRC in older versions of bash as well. Commented Aug 16, 2011 at 8:15