Running an application from the (unix) command line

Mats Cronqvist <>
Tue Jan 24 11:08:06 CET 2006


   you could try this;

$ time erl -boot start_clean -noshell -s echo echo foo -s erlang halt
[foo]

real    0m0.226s
user    0m0.215s
sys     0m0.007s

   mats

Thomas Johnsson wrote:
> Pupeno wrote:
> 
>> On Monday 23 January 2006 05:36, Gunilla Arendt wrote:
>>  
>>
>>> Snip from erl(1):
>>>
>>> "-s Mod [Func [Arg1, Arg2, ...]]
>>>  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."
>>>
>>> Thus "erl -s application start myapp" will result in a call to
>>> "application:start([myapp])" instead of the desired
>>> "application:start(myapp)".
>>>   
>>
>>
>> This doesn't work, I don't know why but what I see is that my 
>> parameters get totally ignored.
>>  
>>
> That's strange. With
> -module(echo).
> -export([echo/1]).
> echo(A) ->
>    io:format("~w~n",[A]).
> and run with
> erl -noshell -s echo echo abc 123 -s init stop
> I get
> [abc,'123']
> written on standard out (plus some junk before that). This on Solaris. 
> This works on windows too (without getting junk before).
> 
> What os are you using? Perhaps you are expecting to get the function 
> value result written on standard out?
> 
> Hope this helps,
> -- Thomas
> 
> 
> 
> 
> 



More information about the erlang-questions mailing list