读书人

怎么在等待输入的地方传值

发布时间: 2013-01-18 10:22:42 作者: rapoo

如何在等待输入的地方传值?
echo -n "The version you want to install:"
read version
tar jxvf *$version*
cd jpf
./INSTALL


运行到./INSTALL运行安装程序,要求输入IP

[sm] Done.
[sm] Please input CMS IP:


此处应该怎么处理,可以在./INSTALL后面加什么吗?
[解决办法]
http://bbs.chinaunix.net/thread-594417-1-1.html
expect基本用法
[解决办法]

引用:
我这是单独写了一个文件,直接放在里面说spawn:command not found
求解怎么直接嵌套在里面,谢谢。

用expect -c,不过推荐的写法是单独放一个文件。

The -c flag prefaces a command to be executed before any in the script. The command should be quoted to prevent being broken up by the shell. This option may be used multiple times.
Multiple commands may be executed with a single -c by separating them with semicolons. Commands are executed in the order they appear. (When using Expectk, this option is specified as
-command.)

读书人网 >UNIXLINUX

热点推荐