Package: dash
Version: 0.5.7-3ubuntu1
Severity: normal

I realize this was found on an Ubuntu system but it also appears in
normal Debian dash.

If I have this shell script:

  $ cat /tmp/t1.sh
  #---
  cat <<EOF | sh || echo "hi die"
  echo subshell
  exit 1
  EOF
  #---

then in both bash and dash I get the expected output:

  $ bash /tmp/t1.sh
  subshell
  hi die

  $ dash /tmp/t1.sh
  subshell
  hi die

But if I change the script to use backticks in the echo instead, then
bash still works:

  $ cat /tmp/t2.sh
  #---
  cat <<EOF | sh || echo "`echo hi` die"
  echo subshell
  exit 1
  EOF
  #---

  $ bash /tmp/t2.sh
  subshell
  hi die

but dash now does not work correctly:

  $ dash /tmp/t2.sh
  subshell

For some reason, adding backticks causes the or-clause to be completely
ignored.  If you use $() instead of backticks, it works again in both
bash and dash:

  $ cat /tmp/t3.sh
  #---
  cat <<EOF | sh || echo "$(echo hi) die"
  echo subshell
  exit 1
  EOF
  #---

  $ bash /tmp/t3.sh
  subshell
  hi die

  $ dash /tmp/t3.sh
  subshell
  hi die

Hope this is helpful in tracking down the problem!


-- System Information:
Debian Release: wheezy/sid
  APT prefers quantal-updates
  APT policy: (500, 'quantal-updates'), (500, 'quantal-security'), (500,
'quantal')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.5.0-21-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dash depends on:
ii  debianutils  4.3.4
ii  dpkg         1.16.7ubuntu6
ii  libc6        2.15-0ubuntu20.1

dash recommends no packages.

dash suggests no packages.

-- debconf information:
* dash/sh: true


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to