System.Cmd.rawSystem provides more portable interface than System.Cmd.system. The behaviour of System.Cmd.system depends on the installed system shell. rawSystem directly creates a new process without interaction with the shell. System.Process module provides even more advanced API. Cheers, Krasimir 2006/7/4, Duncan Coutts <duncan.coutts@worc.ox.ac.uk>:
On Tue, 2006-07-04 at 11:22 +0200, J. E. Palomar wrote:
Hi,
I am newbie in Haskell programing and need to launch a shell command through a Haskell code. In other programing languages like C or Java I know how carry out this task; for instance the code
system("ls -l ")
in C or
exec("ls -l")
in Java work fine and lists the working directory. I know that in interactive mode the Haskell command :! ls -l is similar, but ¿It is possible something like in Haskell non-interactive mode?
The function you're looking for is called 'system' and is in the System module.
System.system :: String -> IO ExitCode
it does just the same as the C and Java versions.
BTW, one way you could have found this out is to search using hoogle:
searching for 'system' gives the one we want as part of the search results
http://haskell.org/hoogle/?q=system
and links to the detailed documentation:
http://haskell.org/ghc/docs/latest/html/libraries/base/System-Cmd.html#v %3Asystem
Duncan
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell