#!/usr/local/bin/bash # ##Note: when you see things like [ ], its usually [] # DATE="`date '+%Y%m%d'`01" #for file in $* ; do while read file ; do #find out what the date/serial number currently is filedate="`egrep [Ss]erial /var/named/primary/$file | awk -F\; '{ print $1 }' | grep -v ^$ | sed "s/[ ]//g"`" # figure out how to increment the serial number if [ $filedate -ge $DATE ] ; then DATE=$(($filedate+1)) fi sed "s/^[ ]*[0-9][0-9]*[ ]*\;[ ]*Serial.*/\ $DATE\ \;\ Serial/g" /var/named/primary/$file > /tmp/$file if [ -s /tmp/$file ] ; then co -l /var/named/primary/$file mv /tmp/$file /var/named/primary/$file ci -u -m"updated with ~jkister/scripts/update_serial" /var/named/primary/$file else echo "$file: error" fi if [ ! "$dontask" ] ; then /usr/ucb/echo -n "next? [yn]: " read next if [ "$next" = "go" ] ; then dontask=1 fi fi #done done < list.foo