#!/bin/bash#example:#usrname='svnuser'#passwd='svnpassword'#svn_link="http://url/svn_dir"#svn_dir="target_dir"usrname=$1passwd=$2svn_link=$3svn_dir=$4svn_flag=".svn"cmd=$(rpm -qa|grep "expect")if [ $? -ne 0 ];then yum -y install expectficd ${svn_dir}if [ -d ${svn_flag} ]&&[ "x${svn_link}" != "x" ] then/usr/bin/expect <<-EOFset timeout 120spawn svn co ${svn_link} . --username ${usrname} --password ${passwd}expect { "*(yes/no)?*" { send "yes\r";exp_continue ;} }EOFelse/usr/bin/expect <<-EOFset timeout 120spawn svn updateexpect { "*Password for 'admin':*" { send "${passwd}\r";exp_continue } "*(yes/no)?*" { send "yes\r";exp_continue ;} }EOFfi