Re: More on i/o and shell commands
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: More on i/o and shell commands
- From: Magnus Nordborg <magnus at fisher.stanford.edu>
- Date: Fri, 7 May 93 16:46:46 -0700
> Date: Fri, 7 May 93 16:30:16 PDT > From: magnus (To: mathgroup at yoda.physics.unc.edu) > To: mathgroup at yoda.physics.unc.edu > Subject: More on i/o and shell commands > > Can someone tell me why this does not work? > RunNumerical[ cmd_String, expr_, pattern_:Number ] := Module[{tmpfile = OpenTemporary[]}, Write[tmpfile,expr]; WriteString[tmpfile,"\n"]; Close[tmpfile]; ReadList[ToString[StringForm[ "! (/bin/rm `1`; /usr/bin/tr -d '{,}' | `2`) < `1`", System`Private`StreamFileName[tmpfile], cmd ]], pattern] ] > > It gives me an empty list, and I cannot figure it out. More information: This works (but boy is it ugly...) RunNumerical[ cmd_String, expr_, pattern_:Number ] := Module[{tmpOut,tmpIn,result}, tmpOut = OpenTemporary[]; tmpIn = OpenTemporary[]; Close[tmpIn]; (* hack to get a file name *) Write[tmpOut,expr]; WriteString[tmpOut,"\n"]; Close[tmpOut]; Run[ToString[StringForm[ "/usr/bin/tr -d '{,}' < `1` | `2` > `3`", System`Private`StreamFileName[tmpOut], cmd, System`Private`StreamFileName[tmpIn] ]]]; result = ReadList[ToString[StringForm[ "`1`", System`Private`StreamFileName[tmpIn]]], pattern]; Run[ToString[StringForm[ "/bin/rm `1` `2`", System`Private`StreamFileName[tmpOut], System`Private`StreamFileName[tmpIn] ]]]; result ] Count the number of started shells... Sigh, any help appreciated. -Magnus --- Magnus Nordborg Department of Biological Sciences Stanford University magnus at fisher.stanford.edu (NeXT mail preferred) +1 (415) 723-4952 (office) +1 (415) 948-7321 (home)