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

RE: logout from interactive subshell



> > I can't use traps here, because I know only at "exit time", whether
> > I want to logout completely, or just go up one level.
> 
> $ call_and_exit() { "$@"; if test $? -eq 42; then exit; fi; }
> $ call_and_exit cleartool ...
> $ exit 42

This looks clever. Maybe one should use "exit 42" too in the definition
of call_and_exit
to propagate the exit up, but basically a nice idea. Maybe only
disadvantage that I have
to think before when calling the subshell (either by calling it via
call_and_exit, or
by setting up suitable aliases for cleartool, bash, zsh etc., to do this
automatically)
- I had hoped I cut do this with an intelligent alias which gets me out
of any deep
nesting of subshells without having done any preparation work before.
But your solution
is at least cleaner than the brute-force way of finding the login shell
via ps, and
then killing it.

Will give your idea a thought. Thanks a lot.

Ronald
-- 
Ronald Fischer (phone +49-89-63676431)
mailto:mn-pg-p-e-b-consultant-3.com@xxxxxxxxxxx



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