#!/bin/shif [ "$1" = "" ]; then exit 1 ; fi if [ "$2" = "" ]; then exit 1 ; fi c1=`expr index $1 "@"` if [ $c1 = 0 ]; then exit 1 ; fi c2=`expr index $2 "@"` if [ $c2 = 0 ]; then exit 1 ; fin1=$1 n2=`echo ${n1##*@}` if [ "$n2" = "***.cn" ] then n3=`echo ${n1%%@*}` else n3=`echo ${n1/@/.}` fin4=$2 n5=`echo ${n4/@/.}` n6=`echo ${n4##*@}` if [ "$n6" = "***.cn" ] then exit 1 fiSAVEIFS=$IFS IFS=" "cou2=`find /proftpd/ -follow -name passwd -exec grep -q ^$n3: {} ; -print` if [ -n "$cou2" ] then for f in $cou2 do echo "ftp: copy $n3 -> $n5" echo $f g=`grep ^$n3: $f` i=`echo ${g/$n3:/$n5:}` grep -q ^$i$ $f if [ $? -ne 0 ] then sed -i.bak "/^$n5:/d" $f sed -i.bak "/^$n3:/ a $i" $f fif2=`echo ${f%/*}`/group echo $f2 cou2=`grep -E "(:|,)$n3(,|$)|(:|,)$n5(,|$)" $f2` if [ $? = 0 ] then perl -i.bak -lape '{s/(:|,)'"$n5"'(,|$)/$1/;s/,$//;if(m/(:|,)'"$n3"'(,|$)/){$_.=",'"$n5"'"}}' "$f2" fi done fiIFS=$SAVEIFS