Extracted regex to local variable as it’s unsupported on bash versions < 3.1.

pull/945/head
Andrew Miller 2017-04-24 15:56:27 +09:00
parent 54b8e1635e
commit e62611ba0d
1 changed files with 2 additions and 1 deletions

View File

@ -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