33c86fe80b5d838b3d3dd454c35aa94f4a38b3f7

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(init): detect and abort on non-zsh shell execution of Oh My Zsh

Diff

 1diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
 2index 545d980f02877e569a05d947f86f27ff419e545a..bf5902fc8c60930dbc331d8a821fa27e47614ea3 100644
 3--- a/oh-my-zsh.sh
 4+++ b/oh-my-zsh.sh
 5@@ -1,3 +1,11 @@
 6+# Protect against non-zsh execution of Oh My Zsh (use POSIX syntax here)
 7+[ -n "$ZSH_VERSION" ] || {
 8+  # ANSI (\033[<code>m): 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red
 9+  printf "\033[1;31mERROR:\033[22m Oh My Zsh can't be loaded from: \033[1m${0#-}\033[22m. " >&2
10+  printf "You need to run \033[1;4mzsh\033[22;24m instead.\033[0m\n" >&2
11+  return 1
12+}
13+
14 # If ZSH is not defined, use the current script's directory.
15 [[ -z "$ZSH" ]] && export ZSH="${${(%):-%x}:a:h}"
16