acctmod-cc.sh
#!/bin/sh
if [ "$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 ; fi
cou3=`find /cruisecontrol/projects/ -name '*.xml' -follow -exec grep -q ""$1"" {} ; -print`
if [ -n "$cou3" ]
then
echo "cc: $1 -> $2"
find /cruisecontrol/projects/ -name '*.xml' -follow -exec grep -q ""$1"" {} ; -print -exec sed -i.bak "s/"$1"/"$2"/I" {} ;
fi
本文分享了一段Shell脚本代码,用于检查并替换指定目录下XML文件中的电子邮件地址。该脚本首先验证输入参数是否包含有效的电子邮件地址,并在确认后进行替换操作。


被折叠的 条评论
为什么被折叠?



