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

Re: Is this possible with zsh?



Meino Christian Cramer wrote:
>  Is it possible to "shell-program" or configure any neat trick (you
>  see, I am missing the right words here...) that "something" will be
>  executed, when the last of the non-login-shells, which are running
>  under my uid, is sclosed ?

You can get arbitrary code to run when a shell exits with:

my-exit-fn() {
  # stuff
}
trap my-exit-fn EXIT

but you still need to work out when the last shell is being closed.
The obvious tricks, other than doing it in the X files rather than the
shell, are to use ps to check processes or to have shells register
and unregister.  The first alternative is likely to be more solid.
You could, for example, check if the parent process was a terminal emulator.

pws


This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com



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