Skip to content

Instantly share code, notes, and snippets.

@oldratlee
Last active September 27, 2016 18:26
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 oldratlee/c0464773de8ddae759862eac3d417293 to your computer and use it in GitHub Desktop.
Save oldratlee/c0464773de8ddae759862eac3d417293 to your computer and use it in GitHub Desktop.
shell convenient alias/function for #erlang
# Run erlang MFA(Module-Function-Args) conveniently, like
# erun fac1 main 25 # example from book programming erlang.
erun() {
if [ $# -lt 2 ]; then
echo "Error: at least 2 args!"
return 1
fi
erl -s "$@" -s init stop -noshell
}
# Run erlang one-line script conveniently, like
# erline 'io:format("Hello world~n").'
erline() {
if [ $# -ne 1 ]; then
echo "Error: Only need 1 arg!"
return 1
fi
erl -eval "$1" -s init stop -noshell
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment