Skip to content

Commit 6cecb0a

Browse files
committed
build: make script cross-platform compatible
1 parent 7067888 commit 6cecb0a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/scripts/update_copyright_years

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ directory_to_scan="${1:-.}"
3131

3232
for file in ${@}; do
3333
echo "Updating copyright notice in $file..."
34-
# For macOS, adding '' after -i to specify no backup file is created.
35-
sed -i '' "s/Copyright (c) [0-9]\{4\} The Stdlib Authors./Copyright \(c\) $current_year The Stdlib Authors./g" "$file"
34+
if [[ "$OSTYPE" == "darwin"* ]]; then
35+
# macOS, where sed requires '' after -i to specify no backup...
36+
sed -i '' "s/Copyright (c) [0-9]\{4\} The Stdlib Authors./Copyright \(c\) $current_year The Stdlib Authors./g" "$file"
37+
else
38+
# Linux and others, no '' required...
39+
sed -i "s/Copyright (c) [0-9]\{4\} The Stdlib Authors./Copyright \(c\) $current_year The Stdlib Authors./g" "$file"
40+
fi
3641
done
3742

3843
echo "Copyright notices updated to $current_year."

0 commit comments

Comments
 (0)