ChinaUnix.net
相关文章推荐:

expect 重定向

我要做一个自动telnet登录脚本。 set timeout -1 spawn telnet server expect "*login" { send "aaa\r" expect -re "(P|p)assword" send "aaa\r" expect > send "exit\r" } 程序已经可以自动登录。 但是现在,我想不输出这些登录的过程(因为这些字符太乱了,要求不显示)。我如何能够完成类似于shell里面...

by jupiters - Shell - 2006-05-24 09:37:43 阅读(4856) 回复(2)

相关讨论

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

by wtuter - Shell - 2008-10-31 10:00:18 阅读(1546) 回复(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 阅读(1121) 回复(1)

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

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

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

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

我用的activetcl for windows 8.4.19.0 , 写了个最简单的expect脚本老是有问题: #!/bin/sh # \ exec tclsh "$0" ${1+"$@"} package require Tcl package require Tk package require expect spawn ssh2 root@server01 expect "root's password:"; send "111111\r" expect "*#"; send "ls\r" expect "*#"; send "exit\r" 可以是它始终报错 : C:\Program Files\active\bin>tclsh c:\ssh_logon.tcl send: spawn id exp4 not ...

by unixu - Shell - 2009-06-23 12:58:10 阅读(3284) 回复(9)

请问谁那里有expect for AIX 的安装包,或者给个链接,拜谢。。。 型号:IBM,9117-570 AIX版本:AIX5.3

by ahqkxfer - AIX - 2009-02-12 11:50:29 阅读(1930) 回复(0)

我写了一段Perl代码, 利用expect自动登录交换机,代码如下: use expect; use strict; use warnings; sub readdata{ open(FILEHANDLE,"change.txt")||die"can not open filename:$!"; my(@array)=; chomp@array; close(FILEHANDLE); return(@array); } my @list=&readdata; for(my $i=0;$i<=$#list;$i++){ my @route=split /,/,$list[$i]; my $timeout = 1; my $cmd1 = "telnet"; my @params = "$route[0]"; m...

by clx009 - Perl - 2008-10-31 12:34:56 阅读(1596) 回复(3)

aa.sh #!/usr/bin/expect # Change a login shell to tcsh set user [lindex $argv 0] spawn chsh $user expect “]:” send “/bin/tcsh ” expect eof exit 执行 ./aa.sh young spawn chsh young Changing shell for young. New shell [/bin/tcsh]: /bin/tcsh 还需要按回车,按了回车就在这里卡住了,该怎么写让它自动完成

by young1986 - Shell - 2008-10-27 00:59:56 阅读(1115) 回复(1)

脚本如下: #!/usr/bin/expect -f set timeout 5 spawn passwd root expect "*password:" sleep 1 send -- "something\r" expect "*password:" sleep 1 send -- "something\r" expect eof 执行结果: spawn passwd root Changing password for root. Enter login(LDAP) password: LDAP Password incorrect: try again Enter login(LDAP) password: LDAP Password incorrect: try again Enter login(LDAP) password: 然后就退出来...

by zhao3stones - Shell - 2008-09-27 22:15:21 阅读(1274) 回复(2)

我用expcet写了一个用ssh远程登陆的脚本,想批量修改linux下默认网关,最后用send "route add ***"更改了只是临时的网关,重启后还是变成原来的。想到只能修改/etc/sysconfig/network-scripts/ifcfg-eth0文件,想用sed更改,但是send "sed ***"脚本执行不起来

by timdcn - Shell - 2008-06-26 11:38:28 阅读(1836) 回复(9)