Dmitry V. Levin wrote:
Hi,
I wonder whether such difference in "trap" behavior is valid:
$ sh -c 'f() { echo f; }; t() { trap f EXIT; trap; }; t'
trap -- 'f' EXIT
f
$ sh -c 'f() { echo f; }; t() { trap f EXIT; trap; }; t&'
trap -- 'f' EXIT
$ sh -c 'f() { echo f; }; t() { trap f EXIT; trap; }; (t)&'
trap -- 'f' EXIT
f
Bash does not run the exit trap in a process forked to run an
asynchronous simple command, regardless of whether or not that
command is a shell function or builtin. It makes special provisions
to run the exit trap in a user-specified subshell -- () -- even
when that subshell is run asynchronously.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong. No day but today.
Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://cnswww.cns.cwru.edu/~chet/