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

exec redirect prevents trap



Dear Zsh Workers,

I have a script like this:

    #!/bin/zsh
    exec > >(tee -a /tmp/foo)
    trap "echo hi" INT TERM EXIT
    sleep 1d;

When I run it and hit ^C, it doesn't print anything. But when I remove
the "exec" line and do the same, it prints "hi". I would have expected
it to print "hi" both times.

- is this a bug?

- is there a way to get the trap to execute, even with the exec line
  present?

Thank you,

Frederick Eaton



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