Extracted regex to local variable as it’s unsupported on bash versions < 3.1.
parent
54b8e1635e
commit
e62611ba0d
|
|
@ -437,7 +437,8 @@ then
|
||||||
example 'pathmunge /path/to/dir is equivalent to PATH=/path/to/dir:$PATH'
|
example 'pathmunge /path/to/dir is equivalent to PATH=/path/to/dir:$PATH'
|
||||||
example 'pathmunge /path/to/dir after is equivalent to PATH=$PATH:/path/to/dir'
|
example 'pathmunge /path/to/dir after is equivalent to PATH=$PATH:/path/to/dir'
|
||||||
|
|
||||||
if ! [[ $PATH =~ (^|:)$1($|:) ]] ; then
|
local re="(^|:)$1($|:)"
|
||||||
|
if ! [[ $PATH =~ $re ]] ; then
|
||||||
if [ "$2" = "after" ] ; then
|
if [ "$2" = "after" ] ; then
|
||||||
export PATH=$PATH:$1
|
export PATH=$PATH:$1
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue