我可以通过命令行或bash脚本启动Erlang文件:
exec erl file.erl@H_404_3@但是,我似乎无法找到如何直接启动此文件中的函数. @H_404_3@例如
exec erl file.erl -f function()@H_404_3@任何建议赞赏……
你可能想要的是erl -s module_name function_name
@H_404_3@请注意,您永远不会像在示例中那样在erl命令中指定erlang文件. Erlang VM加载代码路径中的所有模块.这包括本地目录.
@H_404_3@从http://www.erlang.org/doc/man/erl.html开始:
@H_404_3@-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,…] as
argument. All arguments are passed as
strings. See init(3). @H_404_3@-s Mod [Func [Arg1,…]] (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,…] as argument. All arguments are passed as atoms. See init(3).