On Sun, Feb 13, 2022, 9:48 PM Robert Elz <k...@munnari.oz.au> wrote:

>     Date:        Sun, 13 Feb 2022 21:38:19 -0500
>     From:        "Dale R. Worley" <wor...@alum.mit.edu>
>     Message-ID:  <87o83a895w....@hobgoblin.ariadne.com>
>
>   | The two a-priori plausable behaviors are for the backslash to be taken
>   | literally (which is what happens) or for it to vanish as some sort of
>   | incomplete escape construct.
>
> In most places, an unquoted trailing backslash (ie: followed by
> nothing) produces unspecified results.  If you want a \ then
> quote it ( \\ will do, as would '\', but not "\" for the obvious
> reason...).
>
> When used with echo, things get even more messed up, as in some
> versions of echo, \ is an escape as well, and even if the shell
> you are using leaves the trailing \ intact, there is no guarantee
> that echo will, so even echo \\ is not necessarily going to produce
> a \ on stdout (there is no portable way using echo).
>
> Just avoid this kind of thing (and use printf instead of echo).
>
> kre
>


It occurs to me that the -r option of read is related.

Reply via email to