Skip to content

Instantly share code, notes, and snippets.

@netj
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netj/9065580 to your computer and use it in GitHub Desktop.
Save netj/9065580 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Download and install 3X: a Workbench for eXecuting eXploratory eXperiments
# Usage: curl -s https://gist.github.com/netj/9065580/raw/get-3x | bash -s release=LATEST dest=~/bin
set -eu
# export any given definition as arguments
export "$@"
# defaults to downloading the LATEST release, installing at $HOME/bin/
: ${release:=LATEST} ${dest:=~/bin}
system=`uname -s`-`uname -m`
package=3x-$release-$system.sh
# download the correct binary from GitHub
url=https://github.com/netj/3x/releases/download/$release/$package
echo "Downloading $url"
curl -RLO $url
# make it an executable
chmod +x $package
# install it
mkdir -p $dest
mv -f $package $dest/3x
# modify bash profile to setup PATH if necessary
[ $(type -p 3x) -ef $dest/3x ] || {
echo '# add '"$dest"' to PATH'
echo 'PATH='"$dest"':"$PATH"'
} >>~/.bash_profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment