Cnofirm directories exist before adding to PATH

This commit is contained in:
Nathaniel Landau
2021-09-06 10:36:55 -04:00
parent 832c0ca24e
commit e8e9d51f9d
2 changed files with 9 additions and 6 deletions

View File

@@ -326,9 +326,11 @@ _setPATH_() {
done
for NEWPATH in "${NEWPATHS[@]}"; do
if ! echo "$PATH" | grep -Eq "(^|:)${NEWPATH}($|:)"; then
PATH="${NEWPATH}:${PATH}"
debug "Added '${tan}${NEWPATH}${purple}' to PATH"
if [ -d "${NEWPATH}" ]; then
if ! echo "$PATH" | grep -Eq "(^|:)${NEWPATH}($|:)"; then
PATH="${NEWPATH}:${PATH}"
debug "Added '${NEWPATH}' to PATH"
fi
fi
done
}