Re: Using !/bin/command inside a loop
- To: mathgroup at smc.vnet.net
- Subject: [mg5328] Re: Using !/bin/command inside a loop
- From: "David B. Wagner" <dbwagner at princon.com>
- Date: Wed, 27 Nov 1996 01:47:43 -0500
- Organization: Principia Consulting
- Sender: owner-wri-mathgroup at wolfram.com
Sergio Rojas wrote: > > Hello folks; > > As a single line in any MMa file the line: !/bin/rm filename > does its job. However when that line is included in a loop, a > While loop for example: > > While[ (Otherset = InputString["New set (no to end)? "]) != "no", > !/bin/rm filename ; > n = Input["How many random numbers ?"]; > Print[Table[Random[],{n}]]; > % >> filename] > > the following error message is issued: > > Syntax::sntxf: " !" cannot be followed by "/bin/rm filename;". > > Could somebody explain the correct use of ! for this particular situation? > > Rojas > e-mail: sergio at scisun.sci.ccny.cuny.edu This is because the "!command" syntax is a hack, not a real Mathematica expression. It only works if the ! is the first character in a line, and probably doesn't work at all when nested inside of another command. You should be using the Run or RunThrough commands. --