I need to pass two arguments to my Erlang code. it is working fine in the Erlang shell.
2> crop:fall_velocity(x,23).
21.23205124334434
but how should i run the Erlang code without the Erlang shell. like normal python,c programs. ./program_name (not passing $1 $2 arguments).
I was trying this
erl -noshell -s crop fall_velocity(x,20) -s init stop
But it is giving unexpected token error.
As documentation states, the -s
passes all parameters supplied as just one list of atoms and -run
does the same but as a list of strings. If you want to call arbitrary function with arbitrary parameter count and types you should use -eval
:
$ erl -noshell -eval 'io:format("test\n",[]),init:stop()'
test
$