#!/bin/sh # # Compute a new version string for a shell script if the script has # been changed since the last time this script was run. # FILE=$1 old=`grep "^MD5SUM=" $FILE | sed -e 's/.*=//' -e 's/"//g'` cur=`grep -v "^MD5SUM=" $FILE | md5sum` if [ "$old" != "$cur" ]; then ed -s $FILE -- <<EOF g/^VERSION=/d g/^MD5SUM=/d 1a VERSION="`date` <`id -nu`@`hostname`>" . w q EOF ed -s $FILE -- <<EOF 1a MD5SUM="`md5sum <$FILE`" . w $FILE q EOF fi
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 665 | Rick Richardson | Add automatic version stamping. |