-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path.addlicense.sh
More file actions
executable file
·34 lines (29 loc) · 788 Bytes
/
Copy path.addlicense.sh
File metadata and controls
executable file
·34 lines (29 loc) · 788 Bytes
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
#!/bin/bash
h=$(head -2 .license.txt | tail -1 | sed 's/#//')
echo $h
l=$(cat .license.txt | wc -l)
find ./pipeline/tools/ -type f -name "*.py" | grep -v gdata | while read a ; do
xx=$(head -1 $a)
export f=0
if [ "${xx:0:3}" == "#!/" ] ; then
echo $xx > /tmp/file
export f=1
else
touch /tmp/file
fi
cat .license.txt >> /tmp/file
x=$(grep "$h" $a)
if [ "$x" == "" ] ; then
echo $f $a
if [ "$f" == "0" ] ; then
cat $a >> /tmp/file
else
cat $a | grep -v "$xx" >> /tmp/file
fi
mv /tmp/file $a
else
let tmp=$(cat $a | wc -l)-$l*$(grep "$h" $a | wc -l)+1-$f
echo "$f $tmp grep '$h' $a"
tail -n $tmp $a >> /tmp/file
fi
done