mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Update for compatibility with macOS (BSD grep)
The --max-count option tells grep to stop reading lines after the first matching line. We're looking for the line AFTER the first matching line.
This commit is contained in:
@@ -14,12 +14,12 @@
|
||||
# Fail if a single command fails.
|
||||
set -e
|
||||
|
||||
# `grep -m 1`: find the first occurrence of "BUNDLED WITH"
|
||||
# `grep`: find the occurrences of "BUNDLED WITH" (-m is unnecessary and behaves different on macOS)
|
||||
# `-A`: print the next line after "BUNDLED WITH" as well
|
||||
# `-x -F`: find exactly that string without interpreting regex
|
||||
# `tail -n 1`: take the last line, the version line
|
||||
# `tr -d`: delete all spaces, the indent before the version
|
||||
version="$(grep -m 1 -A 1 -x -F "BUNDLED WITH" Gemfile.lock | tail -n 1 | tr -d '[:space:]')"
|
||||
version="$(grep -A 1 -x -F "BUNDLED WITH" Gemfile.lock | tail -n 1 | tr -d '[:space:]')"
|
||||
|
||||
# if the length of $version is zero
|
||||
if [ -z "$version" ]; then
|
||||
|
||||
Reference in New Issue
Block a user