码迷,mamicode.com
首页 > 其他好文 > 详细

svn 调用脚本(三)

时间:2016-12-14 02:53:12      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:svn

#!/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 调用脚本(三)

标签:svn

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!