From c100149422f04878f01635509b3fe0265f615a54 Mon Sep 17 00:00:00 2001 From: David Chambers Date: Sat, 10 Feb 2018 18:44:51 +0100 Subject: [PATCH] update-copyright-year: permit leading spaces --- bin/update-copyright-year | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/update-copyright-year b/bin/update-copyright-year index cda2615..bd097b2 100755 --- a/bin/update-copyright-year +++ b/bin/update-copyright-year @@ -17,10 +17,10 @@ substitute() { local -r year="$(git log --date=format:%Y --pretty=format:%ad | sort -r | head -n 1)" { while IFS= read -r line ; do - local pattern='^Copyright [(]c[)] [0-9]{4} (.*)$' - if [[ "$line" =~ $pattern ]] && [[ "${BASH_REMATCH[1]}" == "$author" ]] ; then + local pattern='^([ ]*Copyright [(]c[)]) [0-9]{4} (.*)$' + if [[ "$line" =~ $pattern ]] && [[ "${BASH_REMATCH[2]}" == "$author" ]] ; then (( count += 1 )) - echo "Copyright (c) $year $author" + echo "${BASH_REMATCH[1]} $year $author" else echo "$line" fi