Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hadoop-deployer committed Sep 27, 2012
1 parent be0f181 commit a6ca40b
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions cdh4/author.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
# coding=utf-8
# Author: [email protected]
# Data: 2012-09

heads=""
JH='#'

while read LINE; do
char=${LINE:0:1}
if [ "$char" != $JH ]
then
break;
fi
if [ -z "$heads" ]; then
heads="${LINE}";
else
heads="${heads}\n${LINE}";
fi
done < $0

bn=`basename $0`
#echo $heads

function delete_head_annotation
{
j=0
while read LINE; do
char=${LINE:0:1}
#if [ "$char" != $JH -a "$char" != "{" ]
if [ "$char" != $JH ]
then
break;
fi
j=$[j+1]
done < $1
sed -i "1,${j}d" $1
}

DIR=${1:-"."}
DIR=${DIR%/}

for f in `ls $DIR/*.sh|grep -v $bn`; do
echo $f
delete_head_annotation $f
sed -i -e "1i\\${heads}" $f
done

0 comments on commit a6ca40b

Please sign in to comment.