读书人

shell 模拟 按键,该如何解决

发布时间: 2012-11-04 10:42:42 作者: rapoo

shell 模拟 按键
shell里如何模拟按键,我是在写一个脚本,来安装java等,运行了xxx_java_xxx.bin之后,最后一步是按任意键。在shell脚本里如何实现?

Assembly code
#安装Javainstall_java(){    chmod u+x $soft_path"/jdk-6u35-linux-i586.bin"    cp -a $soft_path"/jdk-6u35-linux-i586.bin" /opt     /opt/jdk-6u35-linux-i586.bin        rm -f /opt/jdk-6u35-linux-i586.bin}


这是脚本运行安装完了java的时候:
For more information on what data Registration collects and
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

Press Enter to continue.....


[解决办法]
用 expect 实现自动交互,我最近也在搞,还有些问题,但是可以实现自动输入的。

[解决办法]
sek

读书人网 >UNIXLINUX

热点推荐