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