diff options
author | Marc Cornellà <hello@mcornella.com> | 2021-09-28 11:29:42 +0200 |
---|---|---|
committer | Marc Cornellà <hello@mcornella.com> | 2021-09-28 11:29:42 +0200 |
commit | 33c86fe80b5d838b3d3dd454c35aa94f4a38b3f7 (patch) | |
tree | feeb8513a3e0c628cb75ed19c47e4b8ef9696f7d /oh-my-zsh.sh | |
parent | 93ad3a88214b95f571e03c21f7d9bd76f9110938 (diff) | |
download | zsh-33c86fe80b5d838b3d3dd454c35aa94f4a38b3f7.tar.gz zsh-33c86fe80b5d838b3d3dd454c35aa94f4a38b3f7.tar.bz2 zsh-33c86fe80b5d838b3d3dd454c35aa94f4a38b3f7.zip |
fix(init): detect and abort on non-zsh shell execution of Oh My Zsh
Diffstat (limited to 'oh-my-zsh.sh')
-rw-r--r-- | oh-my-zsh.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 545d980f0..bf5902fc8 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,3 +1,11 @@ +# Protect against non-zsh execution of Oh My Zsh (use POSIX syntax here) +[ -n "$ZSH_VERSION" ] || { + # ANSI (\033[<code>m): 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red + printf "\033[1;31mERROR:\033[22m Oh My Zsh can't be loaded from: \033[1m${0#-}\033[22m. " >&2 + printf "You need to run \033[1;4mzsh\033[22;24m instead.\033[0m\n" >&2 + return 1 +} + # If ZSH is not defined, use the current script's directory. [[ -z "$ZSH" ]] && export ZSH="${${(%):-%x}:a:h}" |