From: Alexander Barton Date: Wed, 22 Apr 2020 09:23:10 +0000 (+0200) Subject: install.sh: Fix some shellcheck(1) warnings, update ax-common.sh code X-Git-Url: https://arthur.barton.de/gitweb/?p=ax-zsh.git;a=commitdiff_plain;h=0166eb3325e612f676008026994c6c1cad965bb5;hp=add56a5b9f3d7bb84ec505fc43c10256979e51a9;ds=sidebyside install.sh: Fix some shellcheck(1) warnings, update ax-common.sh code --- diff --git a/install.sh b/install.sh index cf290b4..782e4cf 100755 --- a/install.sh +++ b/install.sh @@ -5,9 +5,11 @@ # # Include "ax-common.sh": -for dir in "$HOME/lib" "$HOME/.ax" /usr/local /opt/ax /usr; do +ax_common_sourced= +for dir in "$HOME" "$HOME/.ax" /usr/local /opt/ax /usr; do [ -z "$ax_common_sourced" ] || break ax_common="${dir}/lib/ax/ax-common.sh" + # shellcheck source=/usr/local/lib/ax/ax-common.sh [ -r "$ax_common" ] && . "$ax_common" done if [ -z "$ax_common_sourced" ]; then @@ -19,7 +21,7 @@ fi unset dir ax_common ax_common_sourced safe_rm() { - if [ -f "$1" -a ! -L "$1" ]; then + if [ -f "$1" ] && [ ! -L "$1" ]; then rm -f "$1.bak" || abort mv -v "$1" "$1.bak" || abort fi @@ -84,8 +86,7 @@ done if [ ! -d "$AXZSH/active_plugins" ]; then ax_msg - "Initializing plugin directory \"$AXZSH/active_plugins\" ..." - which zsh >/dev/null 2>&1 - if [ $? -eq 0 ]; then + if command -v zsh >/dev/null; then zsh "$AXZSH/bin/axzshctl" reset-plugins || abort else ax_msg 1 "Oops, \"zsh\" not found!?"