Directory listing: mash/

1README  2010-08-01 20:14:11  2,064 bytesRenameDelete
2mash.pl  2010-08-01 16:13:48  5,716 bytesRenameDelete
3pre6/  2010-08-01 19:36:46  DIRECTORY
4shuffle.m  2008-08-28 20:32:56  1,086 bytesRenameDelete
5test.txt  2001-04-18 14:06:47  15 bytesRenameDelete

Contents of README file:

MASH:  Mathematica Scripting Hack
  (The name refers to the fact that the Mathematica kernel ought to 
   support this, but doesn't yet...)
This is how "math -script" should work. Namely, the same way that the
perl/python/ruby/etc interpreters do:
  * take a mathematica source file as its first argument
    (or from stdin if no arguments),
  * make all the arguments available to the mathematica code as an 
    array (list) called ARGV, 
  * evaluate the code,
  * prints to stdout and stderr only what it is explicitly told to.
The advantages of this include having a self-contained mathematica program that
can be executed (with arguments) from the command line, and be used with other 
programs in a pipeline, etc.

For an illustrative example, see shuffle.m in this directory.
The 2 special things about it are 
  1) the first line is something like #!/usr/bin/env /path/to/mash.pl
  2) it assumes that the list ARGV has been set to the command line 
     arguments that the program was called with (which mash does).

Note that, like using mathematica in batch mode, you need to have a plain file 
of just mathematica expressions -- not a notebook file.
To turn a notebook into a plain ".m" file, click on each cell that you want 
included in the ".m" file and choose from the Cell menu: 
Properties -> Initialization Cell.  Then when you save it should ask if you want
to automatically create a package corresponding to the notebook.  Say yes, and 
the ".m" file that's created can be used with mash like so:
  mash file.m
or 
  mash file.m arg1 arg2 ...

If you make sure that the first line of file.m is #!/usr/bin/env /path/to/mash
and make file.m executable then you can just do:
  file.m
or
  file.m arg1 arg2 ...


MASH can also be used to achieve the functionality of webMathematica
by allowing a Mathematica program to implement CGI or be invoked easily
from any programming language using a system() call.
For example, see http://ai.eecs.umich.edu/people/dreeves/simplify/

For versions of Mathematica prior to version 6, see the pre6 directory.

-----

Daniel Reeves