我有以下脚本在Linux OS上下载,安装或更新Java,例如CentOS.
还有比周围更好的东西吗?这是一个非常麻烦的脚本,我想要一个更优雅的解决方案.
###INSTALL
wget http://www.java.net/download/jdk7/binaries/jdk-7-ea-bin-b96-linux-x64-03_jun_2010.bin
chmod a+x jdk-7-ea-bin-b96-linux-x64-03_jun_2010.bin
echo y > answers.txt
./jdk-7-ea-bin-b96-linux-x64-03_jun_2010.bin < answers.txt &>/dev/null
mkdir /jdk7
mv /root/jdk1.7.0 /jdk7
ln -sf /jdk7/bin/java /usr/bin/java
rm -f jdk-7-ea-bin-b96-linux-x64-03_jun_2010.bin
###UPGRADE
wget http://www.java.net/download/jdk7/binaries/jdk-7-ea-bin-b117-linux-x64-04_nov_2010.bin
chmod a+x jdk-7-ea-bin-b117-linux-x64-04_nov_2010.bin
echo y > answers.txt
rm -rf /jdk7
./jdk-7-ea-bin-b96-linux-x64-03_jun_2010.bin < answers.txt &>/dev/null
mv /root/jdk1.7.0 /jdk7
ln -sf /jdk7/bin/java /usr/bin/java
rm -f jdk-7-ea-bin-b96-linux-x64-03_jun_2010.bin
最佳答案
“改进”可以使用yes而不是echo y> answers.txt和…< answers.txt.
使用当前0X中的下一个数字(如果oracle不会更改分配命名约定)检查是否有可用的更新,然后下载并安装它可能是值得的.但我不确定它真的值得.
原文链接:https://www.f2er.com/linux/441008.html