Hello Ralph. Ralph Corderoy wrote in <20210513082404.40c9a20...@orac.inputplus.co.uk>: |> 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. ... [I see you use it, please note heirloom has had problems with ":>FILE", my web42 test script failed many years ago and i find
rm_file() { # This does not work with Heirloom sh(1), even though the construct # works as such; this was reproducable as long as i was tired to find # the problem; let us just use printf(1) instead #: > "${1}" printf '' > "${1}" } I do not use :>X ever since for things possibly ending in the public or meant to be portable. Whatever it may be, does it still use mysterious memory handling, was it a miscompilation, pfff.] |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). Harald van Dijk answered the message for dash like this: This is expected as dash's echo always processes backslashes. bash will give the same output when its xpg_echo option is enabled. Yes i did not know this. The last time i read a bash manual was maybe 2.*, a very long time ago. Then a decade mksh, what do i know. And do not rely on echo(1), ..yes. (It is just, not that long ago, and if i recall correctly, newline escaping with \ to come to a $PS2 line, where the reverse solidus was the last of a couple thereof, was broken here and there, for whatever reason, maybe it appeared to me as something related.) Thanks for the effort. --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)