mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-10 22:13:48 -05:00
Cnofirm directories exist before adding to PATH
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user