ChinaUnix.net
相关文章推荐:

expect 追加文件

使expect把用find命令找到的文件批量拷贝到远程机器上去: find . -name mail.* | xargs -i expect scp.sh {} expect脚本: #!/usr/bin/expect set timeout 0 set file [lindex $argv 0] spawn scp $file root@192。168。0。1:~/ exec sleep 5 expect "*password: " exec sleep 1 send "1111111\r" interact 脚本单独运行成功,使用find . -name mail.* | xargs -i expect scp.sh {}以后文件考贝失败,请问各位高手问题出在哪...

by freemanxp2005 - Shell - 2008-02-27 16:54:17 阅读(1365) 回复(2)

相关讨论

expect使用很方便,可是每次写脚本的时候都需要不断的expect 、send 我想把命令写到一个文件中去,然后用 for ... read i from file expect "$PROMPT" send $i 这种形式来简化expect脚本的书写,不知道如何实现。

by wangrujun - Shell - 2004-05-25 01:43:20 阅读(4730) 回复(13)

ip1.txt文件内容如下 ip password ip password ip password ip password ip password 怎么把ip 和密码读出来并且访问它 用这段不行 #!/usr/bin/expect -f set file [open ip1.txt r] spawn ssh -p 57891 root@×.×.×.× expect { "*(yes/no)?" {send "yes\r"} "*password:" {send "12345678\r"} } expect "*~]$" while{[gets $file line]>=0} { send "scp -P 57891 root@[lindex $line 0]:./*\[0-9t\].tracert* /home...

by 莫帝 - Shell - 2008-11-11 10:38:42 阅读(3638) 回复(7)

#!/usr/bin/expect set router [lindex $argv 0] set passwd_fs [lindex $argv 1] set passwd_en [lindex $argv 2] set ip [lindex $argv 3] spawn telnet $router expect "Password:" send "$passwd_fs\r" expect ">" send "en\r" expect "passwd:" send "$passwd_en\r" expect "#" 我想在这里读入一个文件文件内容是对路由器的一些操作命令,已事先用别的脚本生成好! 请问应该怎么写?谢谢!

by hzmym - Shell - 2007-04-20 15:27:28 阅读(1357) 回复(3)

[code]#!/usr/bin/expect -f set timeout -1 set CORE [lindex $argv 1] set NODE [lindex $argv 2] #echo $CORE spawn bash -c "scp -r {$CORE,$NODE} root@10.14.11.67:/rpms/" expect "* password:*" send "123456\r" expect eof [/code] 出现问题就是只有上传$NODE中的文件。这段代码应该如何填写?

by 真少少 - Shell - 2006-07-19 14:48:17 阅读(761) 回复(1)

如果一个文件夹下有多个文件,请问如何知道这个文件夹内的三个文件(如A, B, C文件)中被更新了的文件,谢谢!

by leowolfking - Shell - 2008-06-06 16:22:00 阅读(1690) 回复(1)

我在shell脚本a.sh中调用了expect脚本a.exp,现在需要在a.exp中执行一系列命令,这些命令在一个文件中存储,请问我如何一行一行地读取这些命令? 有没有像shell中的while read line?? thanks

by spanley - Shell - 2006-01-18 10:44:58 阅读(2835) 回复(10)

想请教一个问题,在expect里面怎样调用shell脚本

by wtuter - Shell - 2008-10-31 10:00:18 阅读(1092) 回复(0)

是否能下列x.x.x.x利用變數的方式 讀入例如/ETC/HOSTS 分別登入不同台SERVER 執行COMMAND #!/usr/bin/expect spawn telnet x.x.x.x expect "login:" send "pom\r" expect "Password:" send "123456\r" expect "$" send "cd /home/p ...

by 68930089 - Shell - 2006-08-15 23:47:56 阅读(695) 回复(1)

请问一下: 我的机子不能用expect,要使用expect,必须安装Tcl,Tcl是个什么东西啊?全称是什么? 谢谢!!

by tyffly - Shell - 2003-07-10 18:13:23 阅读(575) 回复(3)

请问一下: 要使用expect,必须安装Tcl,Tcl是个什么东西啊?全称是什么? 谢谢!!

by tyffly - 其他UNIX - 2003-06-30 13:09:44 阅读(492) 回复(0)