Running an application from the (unix) command line

Matthias Lang matthias@REDACTED
Sat Jan 21 08:53:02 CET 2006


Pupeno writes:
 > Hello,
 > how do you run an application from the command line ?
 > erl -s application start myapp
 > doesn't seem to work.

Try following the instructions in the FAQ exactly:

  | 5.7. ...run an Erlang program directly from the unix shell?
  | 
  | To run Erlang programs without running the Erlang shell, we just pass
  | some more switches to the Erlang virtual machine. Here's hello world
  | again:
  | 
  | 	-module(hello).
  | 	-export([hello_world/0]).
  | 	
  | 	hello_world() -> 
  | 		io:fwrite("hello, world\n").
  | 	
  | 
  | Save this as hello.erl, compile it and run it directly from the unix
  | (or msdos) command line:
  | 
  | 	matthias >erl -compile hello
  | 	matthias >erl -noshell -s hello hello_world -s init stop
  | 	hello, world
	
You find the rest of the FAQ at

  http://www.erlang.org/faq/t1.html

and if you want to know the full details of command line passing, this
part of the manual explains it:

  http://erlang.se/doc/doc-5.4.12/erts-5.4.12/doc/html/erl.html

Matthias



More information about the erlang-questions mailing list