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

FAQ and other shell syntax



read at
http://zsh.sunsite.dk/FAQ/zshfaq01.html#l8

     [ x$ZSH_VERSION = x -a -f $HOME/bin/zsh ] && exec $HOME/bin/zsh -l

It should be noted that contrary to zsh, other shells need their
variables to be quotes (my home dir is "/home/Stephane Chazelas").

if [ -z "$ZSH_VERSION" ] \
  && [ -f "$HOME/bin/zsh" ] \
  && [ -x "$HOME/bin/zsh" ]; then
  SHELL=$HOME/bin/zsh; export SHELL
  exec "$SHELL" -l
fi

and SHELL may be updated so that further xterm/screen/vi...
start the new shell instead of the login shell.

     [ -f $HOME/bin/zsh ] && {
             echo "Type Y to run zsh: \c"
             read line
             [ "$line" = Y ] && exec $HOME/bin/zsh -l
     }

Not every shell/echo support '\c'

Either use:

printf 'Type Y to run zsh: '

or

echo "Type Y to run zsh: " | tr -d '\12'

read line
if [ "x$line" = xY ]; then
  SHELL=$HOME/bin/zsh; export SHELL
  exec "$SHELL" -l
fi

regards,
Stéphane



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