by oefrha · 6y ago · 0 comments
> source $HOME/.zshrc
.zshrc isn't the only startup file, if you place everything there you're likely doing it wrong and should split things like some environment settings to $ZDOTDIR/.zshenv.
Better way to reload startup changes:
alias reload='exec zsh -l' # Load Order Interactive Interactive Script
# Startup Only login Always
# ------------- ----------- ----------- ------
# /etc/zshenv 1 1 1
# ~/.zshenv 2 2 2
# /etc/zprofile 3
# ~/.zprofile 4
# /etc/zshrc 5 3
# ~/.zshrc 6 4
# /etc/zlogin 7
# ~/.zlogin 8
#
# Shutdown
# ------------- ----------- ----------- ------
# ~/.zlogout 9
# /etc/zlogout 10
#
# Note: ZSH seems to read ~/.profile as well, if ~/.zshrc is not present.Technically it's $ZDOTDIR/…
Also note from the official documentation:
> `.zprofile' is meant as an alternative to `.zlogin' for ksh fans; the two are not intended to be used together
alias reload="exec -l $SHELL"
Which I copied from somewhere, I don't know how specific it is but maybe it helps someone :) 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.