From d2285619243cddfeeee69b008c6e4d74addd2a14 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Tue, 27 Apr 2021 12:27:26 -0600 Subject: [PATCH] Use a POSIX-compatible regex in goenv-version-file-read (#176) --- libexec/goenv-version-file-read | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libexec/goenv-version-file-read b/libexec/goenv-version-file-read index 94059662..bd0ec1ba 100755 --- a/libexec/goenv-version-file-read +++ b/libexec/goenv-version-file-read @@ -13,7 +13,8 @@ fi # NOTE: Read the first non-whitespace word from the specified version file. # Be careful not to load it whole in case there's something crazy in it. IFS="${IFS}"$'\r' -words=($(cut -b 1-1024 "$VERSION_FILE" | sed 's/^\s*\(\S\+\).*/\1/')) +words=($(cut -b 1-1024 "$VERSION_FILE" | sed -n 's/^[[:space:]]*\([^[:space:]#][^[:space:]]*\).*/\1/p')) + versions=("${words[@]}") if [ ! -n "$versions" ]; then