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

Re: logout from interactive subshell



> A typical application would go like this:
>
>    rlogin foobar
>    DO SOME STUFF
>    cleartool setview myview # this creates a subshell
>    DO MORE STUFF
>    cleartool setview yourview # now I'm two subshells deep
>    DO STILL MORE STUFF
>    # Now I want to exit
>    exit
>    exit
>    logout
>
> I would like to have a (interactive) command which does the final two
> exits plus
> a logout for me.

I don't know how to do exactly what you have in mind, but I can think of two 
methods that may be of use to you. Both should (usually) work independent of 
which shell you use. The second is close to what you asked for.

1. Shortcut
You can hit "^D" instead of typing exit (or logout) to terminate the current 
shell. If you are three subshells deep, holding Ctrl and hitting "d" three 
times is quite a lot faster, but you still have to keep track of how many 
subshells you want to exit.

2. Screen
After you log into the remote box, start a screen session (simply 
type "screen"). Proceed to do your stuff. After you're done, hit "^A" 
followed by "k". Screen will ask you to confirm and then terminates all your 
subshells, as well as itself.
To logout automatically as well, I suggest you create an alias for the 
command "screen; logout" and run that after login.

(Screen is capable of much more, have a look at the man page if you're 
interested.)

hope this helps,
Christian



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