MathGroup Archive 1999

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

Search the Archive

mathematica scripts (should work like perl and shell scripts)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg17312] mathematica scripts (should work like perl and shell scripts)
  • From: Daniel Reeves <dreeves at eecs.umich.edu>
  • Date: Fri, 30 Apr 1999 23:22:35 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

I'd like to be able to create a file like the following:

test.mma:
   #!/bin/math -script
   a = 2 + 2;
   (* do some other stuff... *)
   Print[a];
   (* do more stuff... *)

then when I make test.mma executable and run it, it should print 4 to
stdout.  Nothing else should go to stdout, just what's explicitly written.
This is the way that perl and shell scripts work and it would be very
convenient/nice/powerful for mathematica to work this way too.  For
example, you could use mathematica directly as a cgi script.

There are some issues though---things the kernel would have to do
differently when the -script option was specified:
  1) allow an input file to be specified as a command line arg
  2) ignore the first line of the input file (the #!/bin/math...)
     (this is automatic in perl and shell scripts since # is comment)
  3) allow a single command to span multiple lines
     (a way to do this would be ignore newlines except after semi-colons)
  4) not print anything to stdout unless told to
     (a stricter version of -batchoutput)

Let me know your thoughts, especially Wolfram developers.  Too bad it's
too late for version 4!


Thanks,
Daniel

--    --    --    --    --    --    --    --    --    --    --    -- 
Daniel Reeves               http://ai.eecs.umich.edu/people/dreeves/

A UNIX saleslady, Lenore,
Enjoys work, but she likes the beach more.
        She found a good way
        To combine work and play:
She sells C shells by the seashore.





  • Prev by Date: SQL Utility
  • Next by Date: Re: Mathematica in Chemistry
  • Previous by thread: SQL Utility
  • Next by thread: Re: mathematica scripts (should work like perl and shell scripts)