Skip to content

Commit 766b0c7

Browse files
detect os and choose the appropriiate version of sed -i
1 parent b159863 commit 766b0c7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

setup.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,13 @@ name=$(basename "$(pwd)" | tr '-' '_')
7575

7676
find . -type f -not -path '*/\.*' -not -name 'setup.sh' -exec sh -c '
7777
if file -b --mime-type "$1" | grep -q "^text/"; then
78-
sed -i "" "s/$2/$3/g" "$1"
78+
if [ "$(uname)" = "Darwin" ]; then
79+
# macOS (BSD sed)
80+
sed -i "" "s/$2/$3/g" "$1"
81+
else
82+
# Linux (GNU sed)
83+
sed -i "s/$2/$3/g" "$1"
84+
fi
7985
fi
8086
' sh {} "$current_name" "$name" \;
8187

0 commit comments

Comments
 (0)