Hi Steffen,
For example it treats un/even reverse solidus at EOLs nice, which is
still not true as of today for shells, for example:
#?0|kent:steffen$ echo du \\\\\
> hey
du \\hey
#?0|kent:steffen$ dash
#kent:$ echo du \\\\\
> das
du \das
#kent:$
I don't think the backslash at the end of the line is relevant. Trying
four Bourne-alike shells, I get two outputs.
A)
bash$ echo foo \\\\bar
foo \\bar
bash$ echo foo \\\\\
> bar
foo \\bar
$ /bin/echo foo \\\\bar
foo \\bar
$ /bin/echo foo \\\\\
> bar
foo \\bar
B)
dash$ echo foo \\\\bar
foo \bar
dash$ echo foo \\\\\
> bar
foo \bar
heirloom$ echo foo \\\\bar
foo \bar
heirloom$ echo foo \\\\\
> bar
foo \bar
Clearly, echo's argv[2] will start with two backslashes. The issue is
whether echo(1) should interpret that as an escape and print out just
one as seen in B.
My echo(1p) here says
‘If the first operand is −n, or if any of the operands contain
a <backslash> character, the results are implementation-defined.’
It says that because there were two entrenched divergent implementations
which couldn't be standardised, thus printf(1).
--
Cheers, Ralph.