I can start an Erlang file either via the command line or bash script:
exec erl file.erl
But, I cannot seem to find out how to directly start a function within this file.
e.g.
exec erl file.erl -f function()
Any suggestions appreciated...
what you probably want is erl -s module_name function_name
Note that you never specify the erlang file in the erl command like you did there in your example. The Erlang VM loads all modules in the codepath. That includes local directory.
From http://www.erlang.org/doc/man/erl.html:
-run Mod [Func [Arg1, Arg2, ...]] (init flag) Makes init call the specified function. Func defaults to start. If no arguments are provided, the function is assumed to be of arity 0. Otherwise it is assumed to be of arity 1, taking the list [Arg1,Arg2,...] as argument. All arguments are passed as strings. See init(3).
-s Mod [Func [Arg1, Arg2, ...]] (init flag) Makes init call the specified function. Func defaults to start. If no arguments are provided, the function is assumed to be of arity 0. Otherwise it is assumed to be of arity 1, taking the list [Arg1,Arg2,...] as argument. All arguments are passed as atoms. See init(3).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With