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