allowed relative path in path functions even though directory may not exist.

master
David Kebler 2020-12-26 12:54:47 -08:00
parent 28bce82117
commit f88453f6ca
1 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ path_remove () {
path_prepend () { path_prepend () {
path_remove $1 $2 path_remove $1 $2
if [ -d "$1" ]; then if ([[ -d "$1" ]] || [[ ! $1 = /* ]]); then
local PATHVARIABLE=${2:-PATH} local PATHVARIABLE=${2:-PATH}
export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}" export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}"
fi fi
@ -22,14 +22,14 @@ path_prepend () {
path_append () { path_append () {
path_remove $1 $2 path_remove $1 $2
if [ -d "$1" ]; then if ([[ -d "$1" ]] || [[ ! $1 = /* ]]); then
local PATHVARIABLE=${2:-PATH} local PATHVARIABLE=${2:-PATH}
export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1" export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"
fi fi
} }
path_insert () { path_insert () {
if [ -d "$1" ]; then if ([[ -d "$1" ]] || [[ ! $1 = /* ]]); then
local PATHVAR=${4:-PATH} local PATHVAR=${4:-PATH}
local temp local temp
echo inserting $1 into ${!PATHVAR} $2 $3 echo inserting $1 into ${!PATHVAR} $2 $3