who can give me short example call system command , read out haskell , e.g. print it?
i know can use system.cmd make system commands like: nm, ls, mkdir etc.
but dont need call them need read , make operations readed string
the key library use the process
package, provides system.process.
to call command , output:
readprocess :: filepath -- command run -> [string] -- arguments -> string -- standard input -> io string -- stdout
like so:
import system.process main = s <- readprocess "/bin/date" [] [] putstrln $ "the date " ++ s
which runs as:
the date fri apr 29 09:29:29 pdt 2011
Comments
Post a Comment