Skip to content

Instantly share code, notes, and snippets.

@seancribbs
Created October 1, 2014 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seancribbs/957e1c210b5ad9cd31c0 to your computer and use it in GitHub Desktop.
Save seancribbs/957e1c210b5ad9cd31c0 to your computer and use it in GitHub Desktop.
# Erlang switching
export PATH="$HOME/erlang/current/bin:$PATH"
# Detects the current erlang version
erlcur() {
DIR=`ls -lr $HOME/erlang | awk '/current/ { print $NF }'`
echo -n ${DIR##*/}
}
# Switches to the given erlang version using wildcards
erlsw() {
TARGET=`find $HOME/erlang -depth 1 -type d -name "*$1*" | head -1`
if [ -z "$TARGET" ]; then
echo "No release matching $1\!"
if [ -e $HOME/erlang/current ]; then
echo Using `erlcur`
fi
return
fi
ln -vnfs $TARGET $HOME/erlang/current
echo Using `erlcur`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment