\" within backquotes within double-quotes treated differently from other shells
echo @` echo "abc" `@ echo @` echo \"abc\" `@ echo "@` echo "abc" `@" echo "@` echo \"abc\" `@" # !!! echo @` echo 'abc' `@ echo @` echo \'abc\' `@ echo "@` echo 'abc' `@" echo "@` echo \'abc\' `@"
Yash's output differs from other shells for the 4th line only.
Other shells' behavior suggests XCU 2.6.3 to be applied to backquotes not enclosed in double quotes while XCU 2.2.3 applies to backquotes in double quotes.
XCU 2.6.3 implies that line continuations in backquotes not enclosed in double quotes are not handled when the command substitution is parsed. They should be handled when the command is parsed while the command substitution is evaluated. However, existing shells (including yash) handle the line continuations when the command substitution is parsed...
echo `echo 'a\ b'`
Fixed in r3639 for the backslash/double quote pair. Line continuation is still processed following the behavior of other shells.
Yash produces @"abc"@ for the command:
but many other shells (bash, ksh, mksh, dash, zsh as sh) produce @abc@.
I suppose POSIX 2013 is rather ambiguous whether such backslashes should be treated as an escaping character.
XCU 2.2.3 says:
while XCU 2.6.3 says:
Which should be applied in this case?