I saw the following snippet in this thread: How to change from csh to bash as default shell
sleep 2
if (-x /usr/local/bin/bash) then
exec /bin/sh -c '. ~/.profile; exec /usr/local/bin/bash'
endif
My understanding is that if you place this snippet in ~/.login
it will invoke bash
when you login.
I have a similar situation where I would like to use a similar snippet to invoke a version of zsh
that is different from the default one with which I log in. Part of the reason why I am going through this trouble is because I can't choose my desired version of zsh
in the options allowed in chsh
, and I don't have administrator privileges.
With this:
- How would I change the snippet above to do this when switching between different versions of zsh?
- Why are two
exec
commands needed in the snippet above? What do they do? Also, why does the snippet above usesh
andbash
(the user is supposed to login withcsh
)
.zprofile
:if [[ $ZSH_VERSION != 4.3.14 ]]; then exec /n/sw/zsh-4.3.14/bin/zsh --login fi
and that seems to work! – Amelio Vazquez-Reina Dec 11 '11 at 22:53