Adrian Hey <[EMAIL PROTECTED]> writes:

> On Wednesday 15 Oct 2003 8:44 am, Salvador Lucas wrote:
> > Dear all,
> >
> > I think this question is not new, but I am not able to
> > find the answer. How to proceed to execute an external
> > Linux command (e.g., 'ls') from a Haskell program?
> >
> > Thanks in advance,
> 
> You can use..
>       system :: String -> IO ExitCode
> in library module System.Cmd
> 

If you want access to its I/O streams as well, you can use
Posix.popen, which is not standard Haskell 98, I think, but it's in
GHC.

  -- Looks up a word by passing it to `cmafihe'.
  cmafihe      :: String -> IO String
  cmafihe word =  popen cmafihePath [] (Just word) >>= return . fst3
      where cmafihePath    = "/usr/local/bin/cmafihe"
            fst3 (a, b, c) = a

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to