Created
January 12, 2012 16:31
-
-
Save hartsock/1601457 to your computer and use it in GitHub Desktop.
A shell script to automatically add any command line utility to your path works with any OS that uses BASH
This file contains 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 | |
# 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 | |
# 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 example: put STS on your CLI | |
# 1. install STS into tools/springsource | |
# 2. create empty directory tools/springsource/current | |
# 3. ln -s tools/springsource/sts-2.8.1.RELEASE tools/springsource/current/bin | |
for file in $HOME/tools/* | |
do | |
if [ -d $file ]; then | |
bindir="$file/current/bin" | |
if [ -d "${bindir}" ]; then | |
PATH="$bindir:$PATH" | |
fi | |
fi | |
done | |
export PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On OS X I put the following line in ~/.profile:
source $HOME/bin/tools.sh
On linux I add that line to ~/.bashrc