Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Bug with trap?



It seems that the trap builtin with the EXIT argument does not work
properly if you have a list inside curly braces and the output is piped
to another command. For example:

~ % zsh <<EOF  
trap "echo exit trap running" EXIT
EOF
exit trap running
~ % zsh <<EOF
{ trap "echo exit trap running" EXIT}
EOF
exit trap running
~ % zsh <<EOF
{ trap "echo exit trap running" EXIT} | cat
EOF
~ % 

Thus the trap in the last example simply did not run. You can try this
with another command in the trap (e.g. touch, or rm) and you will get
the same result: the trap does not run.

This is zsh 4.3.6 on Debian 5.0. Is this a bug or am I missing
something?

Thanks.
Omari



Messages sorted by: Reverse Date, Date, Thread, Author