Last active
September 13, 2016 12:52
-
-
Save vinoski/8867497 to your computer and use it in GitHub Desktop.
Auto-generate bash functions for selecting kerl-installed Erlang versions. Functions are named based on the kerl-installed versions; for example, if you have R16B03 installed as r16b03, your shell will have a function named r16b03 for selecting that version. If you install a new version, run kerl_gen in your shell to regenerate the version selec…
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
export MYKERLVSN='' | |
no_kerl() | |
{ | |
kerl_deactivate | |
unset _KERL_SAVED_AGNER_BIN _KERL_SAVED_AGNER_EXACT_PREFIX _KERL_SAVED_REBAR_PLT_DIR AGNER_BIN AGNER_EXACT_PREFIX | |
MYKERLVSN='' | |
} | |
kerl_gen() | |
{ | |
for k in `ls /usr/local/var/kerl`; do | |
k2=${k/-/_} | |
eval $(echo "$k2() { . /usr/local/var/kerl/$k/activate; MYKERLVSN=$k; }") | |
done | |
} | |
kerl_gen | |
which_kerl() | |
{ | |
[[ -n $MYKERLVSN ]] && printf ' (%s)' $MYKERLVSN | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can call
which_gen
in your bash prompt to have it display which kerl version is currently selected: