diff --git a/etc/scripts/set_copyright_year.sh b/etc/scripts/set_copyright_year.sh index 8a3884eb..2633b190 100755 --- a/etc/scripts/set_copyright_year.sh +++ b/etc/scripts/set_copyright_year.sh @@ -10,10 +10,16 @@ # The script will check the first two lines for a copyright # notice (in case the first line is a shebang). + + while read -rd $'\0' year file; do # Extract the first year from the copyright notice current_year=$(sed -n '1,2s/^\(# Copyright (c) \)\([[:digit:]]\{4,\}\).*/\2/p' "$file") + # Skip the file if no year is found + if [[ -z "$current_year" ]]; then + continue + fi if $CHECK_MODE && [[ "$current_year" != "$year" ]]; then echo "Error: Copyright year mismatch in file $file. Expected $year, found $current_year."