shell 脚本实例

 

检查txt是不是超过一行数据,超过的话就svn 更新文件

 

if [ $USER != 'root' ];then

echo "not root";
exit 1;
fi

p=/usr/local/bbs_new/
n=`cat $1|wc -l`#尼玛赋值要用反引号!!!!!
echo "###############";
echo "have "$n" svn up";
echo "###############";
if [ $n > 1 ];then

cat $1 |while read line
do

for var in $line

do
svn up $p$var
done

done
else
echo 'only one data,plz svnup by yourself';
fi

posted on 2013-01-24 11:40  choose.wang  阅读(110)  评论(0编辑  收藏  举报

导航