bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

'bash -c' does not execute 'trap ... EXIT' command when last command is


From: Steffen Kieß
Subject: 'bash -c' does not execute 'trap ... EXIT' command when last command is an external command
Date: Mon, 13 Oct 2008 22:32:37 +0200

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib
-g -O2 -Wall
uname output: Linux fips 2.6.24-1-amd64 #1 SMP Sat May 10 09:28:10 UTC
2008 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 3.2
Patch Level: 39
Release Status: release

Description:
'bash -c' does not execute a 'trap ... EXIT' command when the last
command is an external command.

Repeat-By:
bash -c '
trap "echo EXIT" EXIT
/bin/true
'
does not produce any output (should write "EXIT").

If an additional newline is included after "/bin/true" the example
works.

The reason seems to be that bash uses exec() for the last command
instead of fork() and exec().

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]