MathematicaScript


is an interpreter for standalone executable Mathematica scripts.

DetailsDetails

  • interpreter allows running standalone executable scripts written using Mathematica language.
  • sets up the environment and then launches the Mathematica kernel in a special mode.
  • Scripts using follow the standard Unix script convention: the first line of the file consists of the "#!" characters, followed by the absolute path to the interpreter, followed by other parameters.
  • The absolute path to the interpreter cannot contain spaces when given in the first line of the script.
  • The absolute path to the file, which is a symbolic link to , is acceptable as the path to the interpreter.
  • The first line of the script must contain the -script option, which must be the last option on the line.
  • The first line of the script is ignored by the kernel when the script is executed.
  • Parameters given on the first line of the script are by default considered as options to the Mathematica kernel.
  • The rest of the script file may contain arbitrary Mathematica commands, which are evaluated sequentially.
  • The script file name and its arguments are accessible from within the script as $ScriptCommandLine.
  • The standard input and output channels , , and are not redirected, so that the script can be used in a pipe with other processes.
  • When the script is run, the Mathematica kernel prints no banner, no In[] or Out[] labels, and generates all output in InputForm, with the PageWidth option effectively set to Infinity.
  • Each of the Mathematica scripts running concurrently starts its own kernel, with no shared variables or definitions. The number of the Mathematica scripts running in parallel may be subject to licensing limitation.
  • When all Mathematica expressions in the script are evaluated, the kernel terminates.
New to Mathematica? Find your learning path »
Have a question? Ask support »