ChinaUnix.net
相关文章推荐:

expect 参数

需求: 从指定目录将zip结尾未经进行gpg的加密: cat ec.sh #!/bin/bash path=/backup/test/ #paw="mypasswd" for file in $(find $path -name "*.zip" -exec basename {} \\ \;) do /backup/test/ce.exp $file done cat ce.exp #!/tools/bin/expect set timeout 5 spawn gpg -se -r dsadBDB -u a7d25c48F $file expect ":" send "mypasswd\r" set file [lindex $argv 0] set ret [/backup/test/ce.exp $file] e...

by a65751844 - Shell - 2013-04-21 18:42:44 阅读(2670) 回复(7)

相关讨论

刚学习perl ,Test::expectexpect—run的prompt到底是什么意思啊?参数该如何设置啊?高手帮帮忙,谢了!

by lilyhit - Perl - 2009-04-14 10:33:21 阅读(1410) 回复(2)

问题是这样的我这里需要登录机器来删除邮件用户,如下 过程如下: $sudo cyradm -user cyrus localhost IMAP Password: mail.abc.com> setacl user.xyma cyrus all mail.abc.com> listacl user.xyma cyrus lrswipcda xyma lrswipcda mail.abc.com> deletemailbox user.xyma mail.abc.com> listacl user.xyma Mailbox does not exist mail.abc.com> quit 我现在想用expect登录之后删除 简单如下: #!/usr/bin/expe...

by xuledw - Shell - 2010-07-15 14:13:35 阅读(7106) 回复(2)

在shell脚本中,能调用expect写的自动交互的脚本,并向它传递参数吗?

by zhmysh - Shell - 2009-09-15 13:27:38 阅读(2077) 回复(1)

说不明白。直接贴代码吧。 spawn ssh -p22 root@**** expect "password:" send "******\r" expect " ~]#" send "/root/config1.sh $argv 1 $argv 2 $argv 3\r" expect " ~]#" send "/root/config2.sh\r" close exit 0 ~ #expect test.sh 1 2 3 spawn ssh -p22 root@**** [email]root@10.10.234.80[/email]'s password: Last login: Mon Jul 28 13:02:15 2008 from ***** [root@localhost ~]# /root/config1.sh 1 2 3 1 1 2 3 2 ...

by jlu204 - Shell - 2008-07-31 18:30:11 阅读(5471) 回复(2)

如题, 试了 print、echo 都没有,, 谢谢

by yjh777 - Shell - 2009-07-24 10:02:22 阅读(3068) 回复(1)

我有一个程序:test.sh ================ #!/bin/expect -f set ip [lindex $argv 0] set disk [lindex $argv 1] ..... ..... ==================== 这里我需要disk是一个数组,我该如何将一个数组传给test.sh 做参数呢 我这么做: disk=(A C) ./test4.sh 192.168.100.19 ${disk[@]} 可是不行哦,我使用puts disk 就只出来一个A,puts disk(1) 出错,说disk 不是数组

by js198388 - Shell - 2007-12-24 10:34:26 阅读(5178) 回复(3)

我在shell的函数里嵌入了expect语句,如下 mo_tel() { expect -c " set timeout 15 spawn telnet $1 expect \"ogin:\" send \"$2\r\" expect \"assword:\" send \"$3\r\" expect \"$2>\" send \"$4\r\" send \"exit\r\" expect eof" } mo_tel IP 用户名 密码 命令1 这样可以正常执行 但是我想脚本里这样调用函数, mo_tel IP 用户 密码 cmd1 mo_tel IP 用户 密码 cmd1 cmd2 mo_tel IP 用户 密码 cmd1 cmd2 cmd3 cmd4 所以,我...

by noveminfo - Shell - 2014-10-16 00:59:29 阅读(3289) 回复(4)

由于squid2.7对htp1.1支持有限,其中squid2.7对请求头信息中含expect 100访问出现417报错, 遇到个棘手问题,请高人指点下,这个需要怎么解决?

expect_100

by 低头、真掩饰 - 服务器应用 - 2012-11-15 20:40:42 阅读(2864) 回复(2)

本帖最后由 zhengsenlin888 于 2011-05-19 18:19 编辑 由于cu没找到expect板块,就发到shell版,请见谅。 我想通过expcet自动登录到各个服务器进行同样操作。然而到底登录哪几个服务器我不固定。我要由参数来判断。 运行命令如下: #./expect fivetrees 123456 5a00 5a01 5ax12 532x1 # 程序名 用户名 密码 主机1 主机2 主机3 主机4 脚本如下: #!/usr/bin/expect #name expect if {$argc <= 2} { s...

by zhengsenlin888 - Shell - 2011-05-23 11:53:08 阅读(3159) 回复(11)

写了一个非常简单的expect脚本如下: 就是让脚本执行用户输入的命令,然后当显示到提示符时就退出 #! /usr/bin/expect -d # $Id$ set cmd [lindex $argv 1] eval "exec $cmd" expect "root@" return 然后执行命令如下: # ./test.exp "ls -l" expect version 5.43.0 argv[0] = /usr/bin/expect argv[1] = -d argv[2] = ./test.exp argv[3] = ls -l set argc 1 set argv0 "./test.exp" set argv "{ls -l}" executing comman...

by soclays - Linux环境编程 - 2010-03-16 15:36:05 阅读(1663) 回复(1)