Package: bash
Version: 3.2-4
Severity: normal

Hi,

I've this script:
#!/bin/sh

cat <<__EOF
$(/bin/echo 'aa\\
b')
__EOF

cat <<__EOF
$(/bin/echo 'aa\
b')
__EOF

\<newline> is removed, but two backslahes aren't replaced by one, as I
expect it would happen is the backslash would be expanded.

% bash /tmp/skript
aa\\
b
aab
% dash /tmp/skript
aa\\
b
aa\
b
% zsh /tmp/skript
aa\\
b
aa\
b

And yes, the section 2.7.4 of the POSIX standard is somewhat unclear.

  If no characters in word are quoted, all lines of the here-document
  shall be expanded for parameter expansion, command substitution, and
  arithmetic expansion. In this case, the backslash in the input behaves
  as the backslash inside double-quotes (see Double-Quotes). However, the
  double-quote character ( ' )' shall not be treated specially within a
  here-document, except when the double-quote appears within "$()", "``",
  or "${}".

Bye, Jörg.

-- System Information:
Debian Release: unstable/experimental
  APT prefers unstable
  APT policy: (900, 'unstable'), (700, 'experimental')
Architecture: powerpc (ppc)

Kernel: Linux 2.6.25
Locale: LANG=C, LC_CTYPE=C (charmap=UTF-8) (ignored: LC_ALL set to de_DE.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bash depends on:
ii  base-files                4.0.4          Debian base system miscellaneous f
ii  debianutils               2.29           Miscellaneous utilities specific t
ii  libc6                     2.7-12         GNU C Library: Shared libraries
ii  libncurses5               5.6+20080614-1 Shared libraries for terminal hand

Versions of packages bash recommends:
pn  bash-completion               <none>     (no description available)

-- no debconf information

Attachment: signature.asc
Description: Digital signature http://en.wikipedia.org/wiki/OpenPGP

Reply via email to