#!/bin/bash # # Update my email to include todays date. set -e T=$(tempfile) D=$(date '+%y%m%d') function mod_file { EMAIL="$1" LETTRE="$2" CONF="$3" if [ -f "$CONF" -a -r "$CONF" ]; then lockfile-create "$CONF" sed "s/${EMAIL}-td-${LETTRE}[0-9]\{6\}@sharewiz.net/${EMAIL}-td-${LETTRE}${D}@sharewiz.net/g" <"$CONF" >"$T" cp "$T" "$CONF" lockfile-remove "$CONF" fi } # The first line will replace echant-td-n040625@sharewiz.net # with echant-td-n040626@sharewiz.net mod_file echant n /home/john/.kde/share/config/knoderc mod_file echant e /home/john/.sylpheed/accountrc mod_file echant e /home/john/.initvar # For apache we should reload but it is done by # logrotate from time to time. mod_file echant w /etc/apache-extern/httpd.conf rm $T