ITeye博客

linux expect

heipark · 2015-07-17 17:08 · 操作系统 · Markdown

1. 创建、编辑文件go.sh

 

#!/usr/bin/expect

spawn sudo su admin

expect  "*password*" { send "13456\r\n" }

interact 

 

2. 设置权限

 

chmod u+x go.sh

3. 运行

./go.sh

 

因为我们要使用expect执行,所以使用命令sh go.sh是不行的,会报“linux expect spawn: command not found”错误。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。