首页 > 其他 > 详细

svn 调用脚本(三)

时间:2016-12-14 02:51:26      阅读:213      评论:0      收藏:0      [点我收藏+]
#!/bin/bash

#example:
#usrname=‘svnuser‘
#passwd=‘svnpassword‘
#svn_link="http://url/svn_dir"
#svn_dir="target_dir"

usrname=$1
passwd=$2
svn_link=$3
svn_dir=$4
svn_flag=".svn"

cmd=$(rpm -qa|grep "expect")
if [ $? -ne 0 ];then
        yum -y install expect
fi

cd ${svn_dir}

if [ -d ${svn_flag} ]&&[ "x${svn_link}" != "x" ] 
then
/usr/bin/expect   <<-EOF
set timeout 120
spawn svn co ${svn_link} . --username ${usrname} --password ${passwd}
expect {
        "*(yes/no)?*" { send "yes\r";exp_continue ;}
 }
EOF
else
/usr/bin/expect   <<-EOF
set timeout 120
spawn svn update
expect {
        "*Password for ‘admin‘:*" { send "${passwd}\r";exp_continue }
        "*(yes/no)?*" { send "yes\r";exp_continue ;}
 }
EOF
fi

svn 调用脚本(三)

原文:http://bobo123.blog.51cto.com/3133979/1882335

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!