PHP Id
#!/bin/bash
case $# in
1);;
*) echo "Usage: $0 file";exit;;
esac;
# File exists?
if [[ -e $1 ]]; then
# File already has $Id$ in it?
if grep -q '\$Id.*\$$' $1 ; then
echo "$1 [skipped]"
else
# After the first <?php (that does not have a ?> on the same line) add the $Id$ comment
sed '
/<?php/ {
/?>/ !{
x
/^$/ {
g
a \
/*\
* $Id$\
*/
h
}
g
}
}
' "$1" >/tmp/sk
mv /tmp/sk "$1"
echo "$1"
fi
else
echo "$1 [missing]"
fi Created by Phill Sparks on 19th December 2007. Last updated on 17th November 2011.