Skip to content

Commit

Permalink
improve .sh file
Browse files Browse the repository at this point in the history
  • Loading branch information
Frosty2500 committed Nov 27, 2024
1 parent 98a924c commit 1493054
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions etc/scripts/set_copyright_year.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 1493054

Please sign in to comment.