Re: shell commands in notebooks
- To: mathgroup at smc.vnet.net
- Subject: [mg22205] Re: shell commands in notebooks
- From: "John M. Jowett" <John.Jowett at cern.ch>
- Date: Fri, 18 Feb 2000 02:34:41 -0500 (EST)
- Organization: CERN
- References: <88dnnt$11q@smc.vnet.net> <88g6ie$4o1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"P.J. Hinton" wrote: > > Neither the front end nor the kernel captures output (stdout or stderr) > from executables invoked by the kernel. As a result the output is not > seen. This is noted in _The Mathematica Book_ (Fourth Edition). You can >>>>>>>>>>>>>>>>>> snip <<<<<<<<<<<<<<<< > You can capture the output with a funciton like this. > > RunCapture[cmd_String, arg__:""] := > Module[ > {outfil = Close[OpenTemporary[]], result, stmp}, > Run[cmd, arg, ">", outfil]; > stmp = OpenRead[outfil]; > result = Read[outfil, Record, RecordSeparators -> {}]; > Close[stmp] > DeleteFile[outfil]; > Return[result] > ] > Is there any disadvantage to using the simpler ReadList["!cmd",Record] which works on Unix and Windows NT at least ? John Jowett ---------------------------------------------------------------------- My home page: http://wwwslap.cern.ch/~jowett/ ----------------------------------------------------------------------