usefull if you like to move some scripts into another repository ...
#!/bin/bash
declare -r RCSTAGS="Date RCSfile Id Revision";
declare -r VALIDFILEEXTENSIONS="php html css js";
declare SEDREPLACE="";
declare -i DOBACK=1;
if [ $1 != "" ]; then
if [ $1 = "-b" ]; then
DOBACK=0;
else
echo "usage: $0 [-b]";
echo "options:";
echo -e " -b: make no backup of original files";
exit 1;
fi
fi
function cleanrcs () {
#if test -z $1; then
# echo "call of $FUNCNAME w/out param";
# exit 1;
#fi
echo "cleaning "`pwd`;
for FILE in *; do
if test -d $FILE; then
echo $FILE" is a dir ... recurse ...";
cd $FILE;
cleanrcs;
cd ..;
else
FILEEXT=`echo $FILE | sed 's/^.*.//g'`;
declare -i DO_RCS=0;
if [ $FILE != $FILEEXT ]; then
for EXT in $VALIDFILEEXTENSIONS; do
if [ $FILEEXT = $EXT ]; then
DO_RCS=1;
fi
done
fi
if [ $DO_RCS -eq 1 ]; then
cat $FILE | sed "$SEDREPLACE" > /tmp/basename"_$$";
[ $DOBACK -eq 1 ] && cp -v $FILE $FILE".rcsbak";
cp -v /tmp/basename"_$$" $FILE;
else
echo "ignoring $FILE";
fi
fi
done
}
function buildsedreplace () {
for rcs in $RCSTAGS; do
SEDREPLACE=$SEDREPLACE's/$'$rcs':.*$/$'$rcs'$/g;';
done
echo $SEDREPLACE;
}
pwd;
buildsedreplace;
cleanrcs;
exit $?
Erstellt: 24.03.2006 11:09 Letzte Änderung: 24.03.2006 11:51