expect问题?
-
- 帖子: 1453
- 注册时间: 2008-05-24 8:30
Re: expect问题?
expect 程序要用 expect 来解释
第一行加
#!/usr/bin/expect
或者
#!/usr/bin/env expect
第一行加
#!/usr/bin/expect
或者
#!/usr/bin/env expect
-
- 帖子: 362
- 注册时间: 2007-06-11 13:06
Re: expect问题?
已经加了还是不行,现在是spawn not found
- xiooli
- 帖子: 6956
- 注册时间: 2007-11-19 21:51
- 来自: 成都
- 联系:
Re: expect问题?
你确定安装了 expect 么?
运行 which expect 看看
运行 which expect 看看
-
- 帖子: 362
- 注册时间: 2007-06-11 13:06
Re: expect问题?
which expect
/usr/bin/expect
/usr/bin/expect
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
-
- 帖子: 1453
- 注册时间: 2008-05-24 8:30
Re: expect问题?
把完整的代码和出错信息贴出来。
-
- 帖子: 6548
- 注册时间: 2008-10-31 22:12
- 系统: 践兔
- 联系:
Re: expect问题?
#!/usr/bin/env expect -f
6f:
6f:
代码: 全选
tlcr: 0 庚寅年七月十四日 21:20:18 ~
● which which
which: shell built-in command
tlcr: 0 庚寅年七月十四日 21:25:09 ~
●
代码: 全选
] ls -ld //
-
- 帖子: 362
- 注册时间: 2007-06-11 13:06
Re: expect问题?
#!/usr/bin/expect
set timeout 60
spawn /usr/bin/ssh -D 7070 -g [email protected]
expect {
“password:” {
send “password\r”
#将第二个 password 改为你自己的密码
}
}
interact {
timeout 60 { send ” “}
}
按照这个来就是替换了自己的端口 username password 和ip地址,居然说spawn not found,expectnotfound
set timeout 60
spawn /usr/bin/ssh -D 7070 -g [email protected]
expect {
“password:” {
send “password\r”
#将第二个 password 改为你自己的密码
}
}
interact {
timeout 60 { send ” “}
}
按照这个来就是替换了自己的端口 username password 和ip地址,居然说spawn not found,expectnotfound
-
- 帖子: 1453
- 注册时间: 2008-05-24 8:30
Re: expect问题?
执行时是输入文件名运行的吗?错误信息就这两条吗?
-
- 帖子: 6548
- 注册时间: 2008-10-31 22:12
- 系统: 践兔
- 联系:
-
- 帖子: 362
- 注册时间: 2007-06-11 13:06
Re: expect问题?
还有什么password not found,什么语法错误
-
- 帖子: 6548
- 注册时间: 2008-10-31 22:12
- 系统: 践兔
- 联系:
-
- 帖子: 362
- 注册时间: 2007-06-11 13:06
Re: expect问题?
我想知道出错的具体原因,不是要另外一种方法
-
- 帖子: 6548
- 注册时间: 2008-10-31 22:12
- 系统: 践兔
- 联系: