Package: dash
Version: 0.5.7-3
Severity: normal

Dear Maintainer,

to have a timestamp in front of every command that is executed, I tried to set
the variable PS4 to '$(date)'.

  #!/bin/sh
  set -x
  export PS4='$(date)'
  /bin/true

This works with bash and results in the following output:

  % bash ./test.sh
  + export 'PS4=$(date)'
  + PS4='$(date)'
  Wed Nov  7 21:55:10 CET 2012/bin/true

If I run the same script in dash it results in a fork bomb. I suppose
it's because when PS4 is evaluated and a sub shell is spawned, it
inherits PS4 and reevaluates it and so on and so forth.

Regards,

Lukas

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-vserver-amd64 (SMP w/24 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.9
ii  libc6        2.13-36

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