日期:2014-05-16  浏览次数:20547 次

如何在等待输入的地方传值?
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.)