#
# 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
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
S=$(dirname "$0")
-if [ "$S" = "$AXZSH" -o "$PWD" = "$AXZSH" ]; then
+if [ "$S" = "$AXZSH" ] || [ "$PWD" = "$AXZSH" ] || [ -L "$AXZSH" ]; then
ax_msg 1 "Initializing \"$AXZSH\":"
else
ax_msg 1 "Install AX-ZSH into \"$AXZSH\":"
-
- [ -L "$AXZSH" ] && rm -f "$AXZSH"
mkdir -p "$AXZSH" || abort
ax_msg - "Copying binaries and scripts ..."
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!?"