本文共 454 字,大约阅读时间需要 1 分钟。
#!bin/sh
function setjdk() { if [ $# -ne 0 ]; thenremoveFromPath '/Library/Java/JavaVirtualMachines/'if [ -n "${JAVA_HOME+x}" ]; thenremoveFromPath $JAVA_HOMEfiexport JAVA_HOME=/Library/Java/JavaVirtualMachines/$1/Contents/Homeexport PATH=$JAVA_HOME/bin:$PATHfi}function removeFromPath() { export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")}#setjdk jdk1.8.0_60.jdksetjdk jdk1.7.0_15.jdk转载于:https://blog.51cto.com/youling87/2047391