#!/bin/sh # # Usage: # init-judge-accounts cd /home for d in judge[1-9]* do echo ">>> $d <<<" rm -fr $d mkdir $d cd $d tar xfz ../judge-skeleton.tar.gz # remove all binary files containing the string "judge1" rm -f $(fgrep -l judge1 $(find .mozilla -type f)) # use ed to change all "judge1"'s to proper account name in all other files for i in $(fgrep -l judge1 $(find . -type f)) do (echo "g/judge1/s//$d/g";echo wq) | ed -s $i done cd .. chown -R $d:judge $d done