File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,17 @@ root=$(
99)
1010echo " Repo root dir: $root "
1111
12- # align GNU vs BSD `sed` version handling -i argument
12+ # macOS includes the BSD version of sed, which uses a different syntax than the
13+ # GNU version, which these scripts expect. So require users of this script to
14+ # install gsed.
1315if [[ " $OSTYPE " == " darwin" * ]]; then
14- sed=" sed -i ''"
16+ if ! command -v gsed & > /dev/null; then
17+ echo " Error: gsed is required but not installed. Install it, for example using 'brew install gsed'."
18+ exit 1
19+ fi
20+ sed=" gsed"
1521else
16- sed=" sed -i "
22+ sed=" sed"
1723fi
1824
1925function update() {
@@ -26,5 +32,5 @@ function update() {
2632 expr=${2}
2733
2834 echo " Updating ${file} - \" ${expr} \" "
29- $sed " ${expr} " " $root /$file "
35+ $sed -i " ${expr} " " $root /$file "
3036}
You can’t perform that action at this time.
0 commit comments