Hacker News new | ask | show | jobs
by oefrha 2212 days ago
Using $SHELL is not great because it is not a reliable env var. It's only set for login shells, and if your login shell isn't zsh you'll get a different shell on this "reload". (A long time ago I had an account somewhere where my sysadmin didn't respond to chsh request for whatever reason, so my login shell remained /bin/bash while I actually used zsh day to day.) It can also be anything, really:

  export SHELL=/sbin/nologin  # or /usr/sbin/nologin, or equivalent on your system
  exec -l $SHELL
You want zsh, so just use zsh.

As for -l, exec zsh -l and exec -l zsh both replace the current shell with a login zsh, so they are effectively the same.