From 72fe7e391d06424dba882e611a1d34673b563f75 Mon Sep 17 00:00:00 2001 From: William Ting Date: Thu, 18 Apr 2013 16:43:43 -0500 Subject: [PATCH] Prevents circular sourcing if shell is #/bin/sh Closes #203. --- bin/autojump.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/autojump.sh b/bin/autojump.sh index 16b0f96..d5a1178 100644 --- a/bin/autojump.sh +++ b/bin/autojump.sh @@ -2,8 +2,12 @@ shell=`echo ${SHELL} | awk -F/ '{ print $NF }'` +# prevent circular loop for sh shells +if [ "${shell}" == "sh" ]; then + exit 0 + # check local install -if [ -s ~/.autojump/etc/profile.d/autojump.${shell} ]; then +elif [ -s ~/.autojump/etc/profile.d/autojump.${shell} ]; then source ~/.autojump/etc/profile.d/autojump.${shell} # check global install