Z-Shell Frequently-Asked Questions
The page explains that, when chsh is unavailable because the shell is not listed in /etc/shells, a personal copy of zsh can still be used at login by replacing the current shell with exec <zsh-path>. It recommends placing that command in a login file such as .profile for sh or ksh, or .login for csh, and warns that exec is unforgiving, so the file should be editable by some other means first.
It gives example snippets for ~/bin/zsh, including optional confirmation prompts before calling exec. It also warns against putting this in .cshrc without checks, because every csh session would become zsh and csh scripts could fail. If zsh is launched from .cshrc, it suggests a minimal safety check with if ($?prompt) exec zsh, and notes that changing SHELL at the same time is sensible. If the user wants the process list to show -zsh, the page suggests linking zsh to -zsh and running exec -zsh, which has the same effect as -l.
Reading notes#
- Use
exec <zsh-path>to replace the current shell with zsh at login. - Put the command in
.profilefor sh or ksh, or in.loginfor csh. - Keep a way to edit the login file before testing, because
execis unforgiving. - A check before
execcan ask the user to type Y. - Avoid putting this in
.cshrcwithout checks, because it affects every csh session and can break csh scripts. - When launching zsh, update the
SHELLenvironment variable to the full zsh path. - To have the shell appear as
-zsh, linkzshto-zshand runexec -zsh. - If root access exists, zsh should be added to
/etc/shells, including on NIS clients, to avoid FTP problems.
