我需要将两个参数传递给我的Erlang代码.它在Erlang shell中运行良好.
2> crop:fall_velocity(x,23). 21.23205124334434
但是如何在没有Erlang shell的情况下运行Erlang代码.像普通的python,c程序../program_name(不传递$ 1 $ 2参数).
我正在尝试这个
erl -noshell -s crop fall_velocity(x,20) -s init stop
但它给出了意外的令牌错误.
正如文档所述,-s
传递所有参数作为一个原子列表提供,-run
并作为一个字符串列表相同.如果要使用任意参数计数和类型调用任意函数,则应使用-eval
:
$ erl -noshell -eval 'io:format("test\n",[]),init:stop()' test $