Launch and executable file inside an Erlang Program

Vance Shipley vances@REDACTED
Sat Jun 30 21:50:24 CEST 2001


> I need that the command/application opens a new shell, execute its
> instrucctions and when finish, it close the shell and return to Erlang
> program.

Which is exactly what os:cmd/1 does.  From the Kernel Refernce Manual
in the section on the os module:
------------------------------------------------------------------------
cmd(Command) -> string()
	
	Types: 
		Command = string() | atom()

	Executes Command in a command shell of the target OS and returns 
	the result as a string. 
------------------------------------------------------------------------

The emulator will spawn an operating system shell in a new process and
feed it the commands you gave it:

	1> os:cmd("pwd; times; echo $SHELL").
	"/export/home/vances\n0m0s 0m0s\n/bin/ksh\n"

  -Vance

Vance Shipley
Motivity Telecom Inc.
+1 519 579 5816



More information about the erlang-questions mailing list