利用expect自动svn

#!/usr/bin/expect
###############################
#
# USAGE: automatically svn check out SVN's ip,you need to install expect first .use "apt-get install expect"
# usage :expect svn.exp
# by expert1 2010-08-31
###############################
set timeout -1
set usr "admin"
set pwd "9182kdsldk%ksds"
spawn /usr/bin/svn co http://250.250.250.250/svn/p2padmin
expect "Password for 'root': "
send "\r"
expect "Username:"
send "$usr\r"
expect "Password for *"
send "$pwd\r"
expect eof
 
===========
以上IP都是举例而已,各位不要尝试,O(∩_∩)O~。
 
这个expect是个好东西,特别在自动交互方面。

作者: expert1   发布时间: 2010-11-03