I would like to write command line scripts in Mathematica, but I cannot find the Argv[i_Integer] function Argv[i_Integer] . (FANTASTIC documents otherwise.)
Argv[i_Integer]
$CommandLine works for Mathematica, MathematicaScript, MathKernel and math.
$CommandLine
args.ma:
#!/usr/bin/env MathKernel -script Print[$CommandLine]
Example:
$ ./args.ma abc {"MathKernel", "-script", "./args.ma", "a", "b", "c"}
$ ScriptCommandLine seems to be the variable you will need for this, provided you use MathematicaScript for scripting . If you use math or MathKernel -script , this will be $ CommandLine .
math
MathKernel -script
Other relevant discussions: pretty old and one in the MMA toolkit .
I like to pass things when using environment variables:
http://reference.wolfram.com/mathematica/ref/Environment.html
Source: https://habr.com/ru/post/900561/More articles:jQuery Mobile Force hides soft keyboard when focusing text input field - jquery-mobileCSS line break character - cssWhat are the names of the new syntax objects added for variable templates? - c ++Internal javascript: how are events implemented? - javascript-eventsHow to hide tab in ExtJS 4 - extjsMenuBar issues QT 4.7.4 on MAC OS LION - qt4gem.add_dependency Jeweler how do you format the git source? - gitConditional HTTP Authentication - ruby-on-railsIf you do "math foo bar", how to get foo and bar inside Mathematica? - wolfram-mathematicaMissing configuration settings in configuration manager - visual-studioAll Articles