-
-
Save svaksha/e902d8b4bda53537552e to your computer and use it in GitHub Desktop.
JVM - Julia Version Manager
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 | |
# I keep Julia binaries in /opt/julia with the same directory structure | |
# as ~/.julia to store different versions, and use this script to switch | |
# between them. I also like to maintain a link of the ~/.julia folder to | |
# ~/julia, for easier package development. | |
JBIN="" | |
PDIR="" | |
if [[ ! "$1" ]]; then | |
echo "Please specify a version, i.e." | |
echo "$ jvm 0.4" | |
exit 1 | |
fi | |
# Look for the package directory | |
if [[ -d "$HOME/.julia/$1" ]]; then | |
PDIR="$HOME/.julia/$1" | |
elif [[ -d "$HOME/.julia/v$1" ]]; then | |
PDIR="$HOME/.julia/v$1" | |
else | |
echo "No Julia packages for version $1 found." | |
exit 1 | |
fi | |
# Look for the executable | |
if [[ -d "/opt/julia/$1" ]]; then | |
JBIN="/opt/julia/$1/bin/julia" | |
elif [[ -d "/opt/julia/v$1" ]]; then | |
JBIN="/opt/julia/v$1/bin/julia" | |
else | |
echo "Didn't find the executable in /opt/julia/<version>" | |
exit 1 | |
fi | |
echo "Linking executable for version $1..." | |
sudo rm /usr/bin/julia | |
sudo ln -s $JBIN /usr/bin/julia | |
echo "Linking packages shortcut for version $1..." | |
rm -r ~/julia; ln -s $PDIR ~/julia |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment