Input in batch script
- To: mathgroup at smc.vnet.net
- Subject: [mg30296] Input in batch script
- From: Carlo Palmisano <palmisano at to.infn.it>
- Date: Wed, 8 Aug 2001 01:33:53 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, Question (partially Mathematica, partially Linux): We have to pass two values (one integer and one string) to a mathematica foo.m running in batch. The integer is simply used in a sum; the string has to be concatenated into a file name (Output) ^^^^^^^^^^^^ Let's imagine to have the following trivial program "foo.m" which requires two inputs (one integer and one string) from the keyboard BUT has to run in **batch** (Linux with Mathematica 4.1). *** foo.m begins **** Clear["Global`*"] a = 1; number = Input["Enter number, e.g., 99 : "]; sumnumber = a + number; sumnumber >> foo1.out string = Input["Enter the string, e.g., 1212_800 : "] string >>> foo1.out m1 = MemoryInUse[] sol = NDSolve[{y''[x] - y'[x] + y[x] ==0,y[0]==1,y'[0]=1},y[x],{x,0,3}] m2 = MemoryInUse[] m3 = (m2-m1) >>> foo???????.out (*We have to replace foo???????.out with foo1212_800.out where 1212_800 is read from the following batchfoo.com *) **** foo.m end *********** The relevant batchfoo.com (executable) contains math <<end1 >>foo.out <<foo.m 99 "1212_800" end1 The trouble lies in the line m3 = (m2-m1) >>> foo??????.out What shall we have to do in order to get foo1212_800.out ? Can you tell us how to modify the foo.m and the script ? Several trials with, e.g., ToString failed. Many thanks for your help. Carlo Palmisano University of Turin via P. Giuria 1 - 10125 Torino - Italy e-mail: palmisan at to.infn.it