zshrc: export SHELL only if unset, don't hardcode path for zsh binary
authorMichael Prokop <mika@grml.org>
Thu, 22 May 2014 10:12:36 +0000 (12:12 +0200)
committerMichael Prokop <mika@grml.org>
Thu, 22 May 2014 10:12:36 +0000 (12:12 +0200)
On e.g. FreeBSD zsh isnt' necessarily available as /bin/zsh, so
let's make that more flexible. Also while at it export SHELL only
if the variable is unset yet, since setting SHELL should be
something the login system care about.

Acked-by: Frank Terbeck <ft@grml.org>
etc/zsh/zshrc

index 50898ce..0c60a9a 100644 (file)
@@ -536,7 +536,12 @@ export PAGER=${PAGER:-less}
 export MAIL=${MAIL:-/var/mail/$USER}
 
 # if we don't set $SHELL then aterm, rxvt,.. will use /bin/sh or /bin/bash :-/
-export SHELL='/bin/zsh'
+if [[ -z "$SHELL" ]] ; then
+  SHELL="$(which zsh)"
+  if [[ -x "$SHELL" ]] ; then
+    export SHELL
+  fi
+fi
 
 # color setup for ls:
 check_com -c dircolors && eval $(dircolors -b)