Hello!
I discovered the changes in how dash handles backslash escape character. I
wonder is that change intentional?
# (Previous version) Dash version 0.5.8.2.1ubuntu2 on Ubuntu
$ dash -c 'exec echo \a\b\c'
abc
# (Current version) Dash version 0.5.10.2 on MacOS 10.13.4 installed by homebrew
$ dash -c 'exec echo \a\b'
\a\b
$ dash -c 'exec echo \a\b\c'
\a\b<NO NEWLINE HERE>
I tested the same command on other shells and got the behaviour similar to the
one observed in previous (0.5.8.2.1ubuntu2) dash version:
# Bash on Ubuntu and MacOS
$ bash -c 'exec echo \a\b\c'
abc
# FreeBSD sh
$ sh -c 'exec echo \a\b\c'
abc
# FreeBSD tcsh
$ tcsh -c 'exec echo \a\b\c'
abc
Interesting enough, "The Open Group Base Specifications Issue 6 IEEE Std
1003.1, 2004 Edition" contains the rather long statement about backslash:
> 2.2.1 Escape Character (Backslash)
> A backslash that is not quoted shall preserve the literal value of
the following character, with the exception of a <newline>. If a <newline>
follows the backslash, the shell shall interpret this as line continuation. The
backslash and <newline>s shall be removed before splitting the input into
tokens. Since the escaped <newline> is removed entirely from the input and is
not replaced by any white space, it cannot serve as a token separator.
But the newer edition (The Open Group Base Specifications Issue 7, 2018 edition
IEEE Std 1003.1-2017) have just the following:
> Escape Character (Backslash)
> There is no additional rationale provided for this section.
Having seen that, I wonder – maybe there is an error on how dash handles
backslash escape character?
Thanks you for your time!
Kindest regards,
Stan Senotrusov