-#!/bin/bash
+#!/usr/bin/env bash
-# Copyright (c) 2014. The SimGrid Team.
+# Copyright (c) 2014-2022. The SimGrid Team.
# All rights reserved.
# This program is free software; you can redistribute it and/or modify it
printf 'Using template: %s\n' "$template"
-now=$(date +%Y)
-
get_dates() {
local file=$1
local date
s/[, ]\+/\n/g
p
}' "$file" \
- | while read date; do
+ | while read -r date; do
case "$date" in
"")
;;
esac
done
git log --format=%ad "$file" | cut -d\ -f5 | uniq
- echo $now
}
format_dates() {
local first
local last
local next
- read first
+ read -r first
last=$first
- while read next; do
+ while read -r next; do
if [ $next -eq $((last + 1)) ]; then
last=$next
else
continue
fi
- if grep -q "Copyright.*SimGrid" $file ; then
+ if grep -q "Copyright.*SimGrid" $file ; then
if head -n 1 "$file" | grep -q '^#!'; then
script=1
else
cat "$tmp_head" "$tmp_copy" "$tmp_foot" > $file
else
echo "Pass: there is no SimGrid Copyright header."
- fi ; #
+ fi ; #
done
cat <<EOF