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

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

Assembly code

#安装Java
install_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