Created
June 20, 2014 18:46
-
-
Save nyarly/f75c7861c4b44ebeb943 to your computer and use it in GitHub Desktop.
Sketch for env driven executable dispatcher
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
> ln -s /usr/bin/ruby /usr/bin/env-dispatcher | |
> ln -s /usr/bin/go /usr/bin/env-dipatcher | |
> export RUBY_VERSION=1.9 | |
> ruby -v | |
1.9.3 p666 |
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
switch $0 | |
case (ruby): | |
switch $RUBY_VERSION | |
case (1.9*): | |
exec /opt/rubies/1.9/bin/ruby "$@" | |
case (2.0*): | |
exec /opt/rubies/2.0/bin/ruby "$@" | |
else: | |
exec /opt/rubies/2.1/bin/ruby "$@" | |
case (go): | |
switch $GO_VERSION | |
case (1.3): | |
#etc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment