Skip to content

Instantly share code, notes, and snippets.

@nyarly
Created June 20, 2014 18:46
Show Gist options
  • Save nyarly/f75c7861c4b44ebeb943 to your computer and use it in GitHub Desktop.
Save nyarly/f75c7861c4b44ebeb943 to your computer and use it in GitHub Desktop.
Sketch for env driven executable dispatcher
> 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
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