I run zsh on my server and I want to alias the exit
command, because whenever I try to terminate my SSH session I must exit from zsh
and exit from bash
.
I tried alias exit='exit;exit'
to no avail.
I don't want to change how I start zsh
but I think it's not a very good solution. I've appended zsh
to /etc/profile
.
How can avoid to type exit
twice to terminate my SSH session?
Best Answer
bash
is the default login shell of your account on that system. To change it, do what @KevinPanko suggests. Thenbash
won't start, onlyzsh
. Given that, through/etc/profile
, you're always startingzsh
at the moment (and not just sometimes), that would probably the best way to do it.Alternatively, you can use the
exec
built-in command ofbash
to replace yourbash
process.man bash
states:So you can run
zsh
like this:Afterwards, if you exit
zsh
, you exit the only shell you're running, and quit immediately.