[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sus behaviour when cmd string ends with single backslash

From: Dale R. Worley
Subject: Re: Sus behaviour when cmd string ends with single backslash
Date: Sun, 13 Feb 2022 21:38:19 -0500

vzvzvz2@gmail.com writes:
> The mentioned bug is indeed fixed by this change. However, in case of
> another edge case following new behaviour is observable:
>  $ bash -c 'echo \'
>  \
>  $ # backslash appears on output

It's an interesting case, since the command that Bash is executing is
with no character at all after the backslash.  The manual page says

       A non-quoted backslash (\) is the escape character.  It  preserves  the
       literal value of the next character that follows, with the exception of
       <newline>.  If a \<newline> pair appears, and the backslash is not  it-
       self quoted, the \<newline> is treated as a line continuation (that is,
       it is removed from the input stream and effectively ignored).

Which doesn't seem to consider this case at all.

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.

So you could plausibly say that the behavior of a backslash before "end
of file" isn't defined.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]