Passing command line options to erlang programs

Muharem Hrnjadovic <>
Tue Oct 26 07:43:26 CEST 2010


I am fairly new to erlang, so please forgive me if this is a stupid
question :-)

I am trying to pass command line options to the following erlang program:

main(Args) -> io:format("~p~n", [Args]).

When only passing command line *arguments* everything works as expected:

$ erl -noshell -s demo main a b c -s init stop

But when passing command line *options* things break

$ erl -noshell -s demo main a -b c -s init stop
$ erl -noshell -s demo main -a b c -s init stop
{"init terminating in

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

Is there another way to sneak options past erl? Or is the code above
broken in some other way?
If no, then maybe erl needs an option passing/escape mechanism like e.g.
gcc's "-Wl" ..?

When using an escript file BTW things works as one would expect.

Best regards/Mit freundlichen Grüßen

Muharem Hrnjadovic <>
Public key id   : B2BBFCFC
Key fingerprint : A5A3 CC67 2B87 D641 103F  5602 219F 6B60 B2BB FCFC

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the erlang-questions mailing list