Skip to content

Commit

Permalink
zsh_reload: use $SHELL to reload zsh only if it's a zsh shell (fixes o…
Browse files Browse the repository at this point in the history
  • Loading branch information
mcornella committed Aug 24, 2020
1 parent cd17aed commit cfb86cd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions plugins/zsh_reload/zsh_reload.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ src() {
zrecompile -p $f && command rm -f $f.zwc.old
done

# Use $SHELL if available; remove leading dash if login shell
[[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh
# Use $SHELL if it's available and a zsh shell
local shell="$ZSH_ARGZERO"
if [[ "${${SHELL:t}#-}" = zsh ]]; then
shell="$SHELL"
fi

# Remove leading dash if login shell and run accordingly
if [[ "${shell:0:1}" = "-" ]]; then
exec -l "${shell#-}"
else
exec "$shell"
fi
}

0 comments on commit cfb86cd

Please sign in to comment.