]> arthur.barton.de Git - ax-zsh.git/blobdiff - bin/axzshctl
Try harder to detect location of the AX-ZSH installation
[ax-zsh.git] / bin / axzshctl
index e64e80ac8584150829ac4931c11d4839a21f34fb..b9d20d36a17fde3001c7097f3ea9ccee73b594e1 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/zsh
+#!/usr/bin/env zsh
 #
 # AX-ZSH: Alex' Modular ZSH Configuration
 # Copyright (c) 2015-2016 Alexander Barton <alex@barton.de>
@@ -266,9 +266,12 @@ NAME="$0:t"
 
 [[ $# -gt 0 ]] || Usage
 
-if [[ -z "$AXZSH" || ! -d "$AXZSH" ]]; then
-       ax_msg 2 "Oops, \"AXZSH\" is not set or invalid!"
-       exit 3
+if [[ -z "$AXZSH" || ! -r "$AXZSH/ax.zsh" ]]; then
+       [[ -r "$HOME/.axzsh/ax.zsh" ]] && AXZSH="$HOME/.axzsh"
+       if [[ ! -r "$AXZSH/ax.zsh" ]]; then
+               ax_msg 2 "Oops, \"AXZSH\" is not set or invalid and can't be autodetected!"
+               exit 3
+       fi
 fi
 
 cmd="$1"