Re: Running the kernel command line with additional input files
- To: mathgroup at smc.vnet.net
- Subject: [mg61650] Re: Running the kernel command line with additional input files
- From: albert <awnl at arcor.de>
- Date: Mon, 24 Oct 2005 21:07:07 -0400 (EDT)
- References: <djhsok$shl$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, > I have a package myPack.m that reads input from two text files > file1.txt file2.txt > > The names of the files will change from job to job and thus have to be > given by the user. > > Thus I would like to run something like > math < myPack.m (whatever) file1.txt file2.txt I had the same problem once and couldn't find a way to pass additional arguments to a mathematica script this way. Anyway it is rather simple to write a shell (or batch or whatever-) script which writes mathematica-code to a file which contains the arguments, and that's what I ended up doing. e.g. in a bourne shell: #!/bin/sh file1=$1 file2=$2 cat > tmpscript.m <<EOF file1 = "$file1"; file2 = "$file2"; Get["mypack.m"]; EOF math < tmpscript.m > result.txt I think you get the point... hth albert