1 # switch PATH to new JAVA_HOME
4 # remove element from colon separated list
5 # usage: path_remove <pathvar> <pathelement>
6 eval path_removeP
="\"\$$1\""
7 path_removeP
=`(NP= S= IFS=: ; for P in $path_removeP; do [ "$P" = "$2" ] && continue; NP="$NP$S$P"; S=':'; done; echo "$NP")`
8 eval $1='"$path_removeP"'
9 eval [ "\"\$$1\"" ] ||
unset "$1"
12 path_remove PATH
"/opt/java/jre/bin"
13 path_remove PATH
"/opt/java/bin"
14 path_remove PATH
"/opt/java5/jre/bin"
15 path_remove PATH
"/opt/java5/bin"
17 if [ "$JAVA_HOME" ]; then
18 path_remove PATH
"$JAVA_HOME/bin"
19 path_remove PATH
"$JAVA_HOME/jre/bin"
20 PATH
=$JAVA_HOME/jre
/bin
:$PATH
22 [ -f "$JAVA_HOME/bin/java" ] || JAVA_HOME
=$JAVA_HOME/jre
# if jdk not installed