On Mon, Dec 28, 2009 at 10:31 PM, J.C. Roberts <[email protected]>
wrote:
> On Mon, 28 Dec 2009 20:14:33 -0800 Philip Guenther <[email protected]>
> wrote:
...
>> 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?
...
> 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?

Sure:

$ printf 'foo\\\\bar\n'
foo\\bar
$ printf 'foo\\\\bar\n' | { read -r foo; echo "$foo"; }
foo\bar
$ bash
bash-4.0$ printf 'foo\\\\bar\n' | { read -r foo; echo "$foo"; }
foo\\bar
bash-4.0$

Reply via email to