forked from scalatest/scalatest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
updateCopyright.bash
executable file
·60 lines (53 loc) · 2.02 KB
/
updateCopyright.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# 2013-0827 Darlene Wallach script to update the Artima, Inc. Copyright date
# in all scala and java files in all the src and
# examples directories
echo `pwd`
# set the variable for the Artima, Inc. Copyright year for the current year
theYear=`date +%Y`
# set the replace string for sed
curCopyright="Copyright 2001-${theYear}"
# getting all the scala files in the src directories
for file in `find ./src -type f | grep '\.scala'`
do
# find the scala files with an outdated Artima, Inc. Copyright
grep Copyright ${file} | grep "Artima, Inc." | grep -v ${theYear} > /dev/null
if [ $? == 0 ]
then
# use sed to edit the file in place - current year for Artima, Inc. Copyright
sed -i -e "s/Copyright 2001-20../$curCopyright/" ${file}
fi
done
# getting all the java files in the src directories
for file in `find ./src/ -type f | grep '\.java'`
do
# find the java files with an outdated Artima, Inc. Copyright
grep Copyright ${file} | grep "Artima, Inc." | grep -v ${theYear} > /dev/null
if [ $? == 0 ]
then
# use sed to edit the file in place - current year for Artima, Inc. Copyright
sed -i -e "s/Copyright 2001-20../$curCopyright/" ${file}
fi
done
# getting all the scala files in the examples directories
for file in `find ./examples/src/ -type f | grep '\.scala'`
do
# find the scala files with an outdated Artima, Inc. Copyright
grep Copyright ${file} | grep "Artima, Inc." | grep -v ${theYear} > /dev/null
if [ $? == 0 ]
then
# use sed to edit the file in place - current year for Artima, Inc. Copyright
sed -i -e "s/Copyright 2001-20../$curCopyright/" ${file}
fi
done
# getting all the java files in the examples directories
for file in `find ./examples/src/ -type f | grep '\.java'`
do
# find the java files with an outdated Artima, Inc. Copyright
grep Copyright ${file} | grep "Artima, Inc." | grep -v ${theYear} > /dev/null
if [ $? == 0 ]
then
# use sed to edit the file in place - current year for Artima, Inc. Copyright
sed -i -e "s/Copyright 2001-20../$curCopyright/" ${file}
fi
done