Erl -noshell
Just a small shell wrapper to execute Erlang programs without starting the interactive shell. Saving time when working with sample code from the tutorials ;)
#!/bin/bash # # Purpose: execute erlang program from the command line # side effect is creating beam with native code inside (Hipe) # Usage: erxec <module> <func> # Sample: erxec hello hello_world MODULE=${1:?"Enter module name"} if [ ! -f $MODULE.erl ]; then echo "[E] $MODULE.erl not found" exit 99 fi FUNC=${2:?"Enter function name"} [ -e $MODULE.beam ] || erlc +native $MODULE.erl #can be: erl -noshell -s $MODULE $FUNC -s erlang halt erl -noshell -s $MODULE $FUNC -s init stop
TODO: how to call functions with arguments?