Skip to content

Commit

Permalink
Use a POSIX-compatible regex in goenv-version-file-read (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
neersighted authored Apr 27, 2021
1 parent 46ad842 commit d228561
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libexec/goenv-version-file-read
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d228561

Please sign in to comment.