Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: shell commands in notebooks

  • To: mathgroup at
  • Subject: [mg22205] Re: shell commands in notebooks
  • From: "John M. Jowett" <John.Jowett at>
  • Date: Fri, 18 Feb 2000 02:34:41 -0500 (EST)
  • Organization: CERN
  • References: <88dnnt$> <88g6ie$>
  • Sender: owner-wri-mathgroup at

"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 


which works on Unix and Windows NT at least ?

John Jowett 

My home page:

  • Prev by Date: Exporting BMP files in M4
  • Next by Date: Re: Integrate with If
  • Previous by thread: Re: shell commands in notebooks
  • Next by thread: Re: shell commands in notebooks