[erlang-questions] Passing arguments to erlang from the command line

Jani Hakala jahakala@REDACTED
Sat Nov 18 01:33:59 CET 2006


Andy Khan <andyk@REDACTED> writes:

> Hi,
>
> I'm playing with the pingpong example in the tutorial, and I'm trying to 
> launch the ping process directly from the command line.  When I run the 
> program as follows:
>
>>erl -sname ping -run pingpong start_ping pong@REDACTED
>
>From the erl man page:
 -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).

So pong@REDACTED ends up being a string.

How about using -eval "pingpong:start_ping(pong@REDACTED)"

Jani Hakala



More information about the erlang-questions mailing list