From e62611ba0dbe04d037ac2ef57b908a57fb20c20e Mon Sep 17 00:00:00 2001 From: Andrew Miller Date: Mon, 24 Apr 2017 15:56:27 +0900 Subject: [PATCH] =?UTF-8?q?Extracted=20regex=20to=20local=20variable=20as?= =?UTF-8?q?=20it=E2=80=99s=20unsupported=20on=20bash=20versions=20<=203.1.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/helpers.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index 607e0047..d9dad053 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -437,7 +437,8 @@ then 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' - if ! [[ $PATH =~ (^|:)$1($|:) ]] ; then + local re="(^|:)$1($|:)" + if ! [[ $PATH =~ $re ]] ; then if [ "$2" = "after" ] ; then export PATH=$PATH:$1 else