On Mon, 28 Dec 2009 20:14:33 -0800 Philip Guenther <guent...@gmail.com> wrote:
> On Mon, Dec 28, 2009 at 5:58 PM, J.C. Roberts > <list-...@designtools.org> 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 Philip, Thanks for the opengroup info! I went to file the bug report but I could not confirm your assertion in code. Before sending the report, I simply added the '-r' option to 'read' in my previously posted script, and it works fine when the backslash is somewhere within the line? Could you elaborate? Thanks, jon -- J.C. Roberts