[erlang-questions] how to call os:cmd("ls") from shell?

Bengt Kleberg bengt.kleberg@REDACTED
Wed Jul 11 13:54:20 CEST 2007


On 2007-07-11 08:06, Jeremy Chow wrote:
> hi list,
> 
> I fellowed the otp document, but it failed.
> 
> # erl -s os cmd ls

this will not work.
1 erl -s will bundle the arguments (ls) into a list as atoms.
	os:cmd( [ls] ).
2 os:cmd/1 wants a string. os:cmd("ls").


one might think that
erl -run os cmd ls
will work since -run keeps the arguments as strings, but -run also 
bundles all arguments into a single string.

so you have to write an interface module that calls os:cmd/1 for you.


bengt
-- 
Those were the days...
    EPO guidelines 1978: "If the contribution to the known art resides
    solely in a computer program then the subject matter is not
    patentable in whatever manner it may be presented in the claims."



More information about the erlang-questions mailing list