On Mon, Dec 28, 2009 at 5:58 PM, J.C. Roberts <[email protected]> wrote:
> Calling this a "bug" seems unfair since it really falls in the category
> of "Don't Do That!" or more likely, "Only an idiot would do that!" None
> the less, I'm curious how you would classify this unexpected behavior.
>
> The 'while read VAR; do ...; done < file.txt' construct has a somewhat
> odd behavior in ksh when lines within the input file contain a
> backslash followed by a space (or possibly other typically escaped
> characters).
That behavior is correct an in accordance with the standard. Check out:
http://www.opengroup.org/onlinepubs/9699919799/utilities/read.html
A script that doesn't want that behavior should be using the -r option
to 'read'...but's there's a bug in our sh: the -r option only disables
the handling of backslash at EOL and not embedded in the line. Oops.
Can you file a bug for this with sendbug?
Philip Guenther