Skip to content

Instantly share code, notes, and snippets.

@tmlbl
Last active March 20, 2016 06:19
Show Gist options
  • Save tmlbl/430f7d54cda16a43bff6 to your computer and use it in GitHub Desktop.
Save tmlbl/430f7d54cda16a43bff6 to your computer and use it in GitHub Desktop.

Revisions

  1. tmlbl revised this gist Jun 21, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion jvm
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,8 @@

    # 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.
    # between them. I also like to maintain a link of the ~/.julia folder to
    # ~/julia, for easier package development.

    JBIN=""
    PDIR=""
  2. tmlbl created this gist Jun 21, 2015.
    40 changes: 40 additions & 0 deletions jvm
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    #!/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.

    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