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

Re: zsh-4.1.1 and trap '...' DEBUG: a bug or a feature?



On Tue, Mar 23, 2004 at 10:54:22AM -0700, Nelson H. F. Beebe wrote:
> Notice that zsh takes one final DEBUG trap that bash does not.

This is because your EXIT trap had one command in it.  If it had two
commands, you would have seen two final DEBUG trap executions.  One
way to avoid this is to turn off DEBUG in the exit trap:

trap 'trap - DEBUG; echo This is an EXIT trap' EXIT
trap 'echo This is a DEBUG trap' DEBUG
pwd
pwd
pwd
pwd

That would duplicate the bash behavior you saw.  However, I don't know
if this is proper POSIX behavior or not.

..wayne..



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