bug-bash
[Top][All Lists]
Advanced

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

can not save traps


From: mwang
Subject: can not save traps
Date: Tue, 1 Feb 2005 23:54:22 -0500

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib   -g -O2
uname output: Linux mercury 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 
i686 i386 GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 3.0
Patch Level: 0
Release Status: release

Description:

The POSIX standard says:

-- begin quote --
The trap command with no arguments shall write to standard output a list
of commands associated with each condition. The format shall be:

"trap -- %s %s ...\n", <action>, <condition> ...


The shell shall format the output, including the proper use of quoting,
so that it is suitable for reinput to the shell as commands that achieve
the same trapping results. For example:

save_traps=$(trap)
...
eval "$save_traps"
-- end quote --

This is not happening in bash-3.00:

bash-3.00$ trap
trap -- 'echo a' EXIT
bash-3.00$ a=$(trap)
bash-3.00$ echo "$a"
bash-3.00$ <no output>

Repeat-By:

trap 'echo a' exit
a=$(trap)
echo $a




reply via email to

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