Skip to content

Instantly share code, notes, and snippets.

@hartsock
Created December 1, 2011 12:30
Show Gist options
  • Save hartsock/1416383 to your computer and use it in GitHub Desktop.
Save hartsock/1416383 to your computer and use it in GitHub Desktop.
automatically add the tool to your path
#!/bin/bash
# which programs do you want to install into your path?
programs=( groovy grails gradle scala )
# relies on the conventions:
# 1. all tools go into ~/tools
# 2. all tools are configured with a 'current' symlink for
# the currently in-use version
# 3. all tools have a 'bin' directory
# 4. call this from your .bashrc or .profile or whatever
# for example: to upgrade from grails 1.3.6 to 1.3.7
# $ cd ~/tools/grails
# $ rm current
# $ ln -s grails-1.3.7 current
for program in "${programs[@]}"
do
bindir="$HOME/tools/$program/current/bin"
if [ -d "$bindir" ]; then
PATH="$bindir:$PATH"
fi
done
export PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment