Read terms from the command line

Ulf Wiger <>
Wed Feb 18 22:33:34 CET 2004

On 17 Feb 2004 12:58:08 -0600, Martin J. Logan <> 

> 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

erl_scan:string/1 and erl_parse:parse_term/1 can be used to
convert to erlang terms, if necessary.

Ulf Wiger

More information about the erlang-questions mailing list