From cc80cae223163c064f7858332aa07c19bca74615 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Fri, 1 Jul 2022 11:31:35 +0200 Subject: [PATCH] path: don't add directories to PATH if they don't exist --- config/shell/path.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/shell/path.sh b/config/shell/path.sh index b991fa9..caeedd0 100644 --- a/config/shell/path.sh +++ b/config/shell/path.sh @@ -13,6 +13,7 @@ # Add custom bin dirs to PATH if they exist and are not already in PATH. while read -r dir; do + [ -d "$dir" ] || continue # skip if directory doesn't exist case ":${PATH:=$dir}:" in *:"$dir":*) ;; # already in PATH -> ignore *) PATH="$dir:$PATH" ;; # not yet in PATH -> prepend it @@ -32,6 +33,7 @@ export PATH # available. command -v manpath >/dev/null 2>&1 && MANPATH="$(unset MANPATH; manpath)" while read -r dir; do + [ -d "$dir" ] || continue # skip if directory doesn't exist case ":${MANPATH:=$dir}:" in *:"$dir":*) ;; # already in MANPATH -> ignore *) MANPATH="$dir:$MANPATH" ;; # not yet in MANPATH -> prepend it