From e75abb77958c279d59970946931718ebca69ffc3 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Sun, 12 Feb 2017 16:22:28 +0100 Subject: [PATCH] Test the directory before adding it --- .setpath.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.setpath.sh b/.setpath.sh index defa517..491ecb7 100644 --- a/.setpath.sh +++ b/.setpath.sh @@ -1,4 +1,6 @@ BIN_PATH="$HOME/bin" -found=$(echo $PATH | tr ':' '\n' | grep -w "$BIN_PATH") -[ ! "$found" ] && export PATH="$BIN_PATH:$PATH" -true +if [ -d "$BIN_PATH" ]; then + found=$(echo $PATH | tr ':' '\n' | grep -w "$BIN_PATH") + [ ! "$found" ] && export PATH="$BIN_PATH:$PATH" + true +fi