Read terms from the command line

Richard Carlsson richardc@REDACTED
Thu Feb 19 10:52:11 CET 2004


Actually, 'erl -s ...' passes the arguments as atoms (which among
other things limits their size to 255 characters).

Use 'erl -run ...' to have them passed as strings.

	/Richard

On Wed, 18 Feb 2004, Ulf Wiger wrote:

> > Anyone know how to read erlang terms off the command line. Specifically
> > I would like to call an erlang function via erl -s or something similar
> > and pass the function terms. Does anyone know of a method to "consult"
> > chars passed in from the command line.
>
> You can use init:get_arguments() to inspect the command line.
>
> To get erlangs terms, you'll have to do some parsing.
>
> If you use -s, the function will get the arguments as a list of
> strings.
>
> erl_scan:string/1 and erl_parse:parse_term/1 can be used to
> convert to erlang terms, if necessary.
>
> /Uffe
> --
> Ulf Wiger
>
>

Richard Carlsson (richardc@REDACTED)   (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED	WWW: http://user.it.uu.se/~richardc/
 "Having users is like optimization: the wise course is to delay it."
   -- Paul Graham



More information about the erlang-questions mailing list