Last active
December 7, 2021 11:50
-
-
Save luizrobertofreitas/cc31f92563a43d03a7d40bbad734f89c to your computer and use it in GitHub Desktop.
Change jdk script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
versions=(8 11) | |
if [ $# -eq 0 ] | |
then | |
echo "No arguments supplied. exiting" | |
exit 1 | |
fi | |
if [[ " "${versions[@]}" " == *" "$1" "* ]] ;then | |
echo "changing to Jdk ${1}" | |
sudo rm /opt/jdks/java_home | |
sudo ln -s /opt/jdks/$1 /opt/jdks/java_home | |
java -version | |
else | |
echo "$1 not recognized. valid values are 8 and 11" | |
exit 2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment