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

Other shells (e.g. dash, zsh) demonstrate no such difference:
$ ash -c 'f() { echo f; }; t() { trap f EXIT; trap; }; t'
trap -- 'f' EXIT
f
$ ash -c 'f() { echo f; }; t() { trap f EXIT; trap; }; t&'
trap -- 'f' EXIT
f
$ ash -c 'f() { echo f; }; t() { trap f EXIT; trap; }; (t)&'
trap -- 'f' EXIT
f


-- 
ldv

Attachment: pgptS0swUAu5A.pgp
Description: PGP signature

Reply via email to