我有一个函数以模块mymodule中的两个参数开头。我如何从命令行运行此功能。如何在linux命令行的模块中运行带有参数的函数
我试试这个:
erl -name [email protected] -s mymodule start 5 10
但它会引发错误: { “初始化终止于do_boot”,{民主基金,[{MyModule的,启动,[ '5', '10']} {初始化,start_it,1},{初始化,start_em,1}]}}
我希望能够从一个bash文件
我有一个函数以模块mymodule中的两个参数开头。我如何从命令行运行此功能。如何在linux命令行的模块中运行带有参数的函数
我试试这个:
erl -name [email protected] -s mymodule start 5 10
但它会引发错误: { “初始化终止于do_boot”,{民主基金,[{MyModule的,启动,[ '5', '10']} {初始化,start_it,1},{初始化,start_em,1}]}}
我希望能够从一个bash文件
运行这个功能,我认为它预计启动功能,具有元数一个,所以在这种情况下,它试图调用module:start(['5','10'])。所以改变你的启动函数来接受[arg1,arg2]中的2个参数列表。另外,请查看-run和-s标志上的文档。 -s将参数作为原子传递,而将其作为字符串传递给它们
-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).