user354134
user354134

Reputation:

If doing "math foo bar", how to get foo and bar inside Mathematica?

If I run Mathematica as "math foo bar", what variable(s) hold foo and bar? I'm guessing it's $Something, but haven't found it.

Googling told me Mathematica accepts command-line options like -pwpath, -pwfile, but I couldn't find the right search phrase for actual command line arguments (not options).

Upvotes: 3

Views: 230

Answers (1)

WReach
WReach

Reputation: 18271

The $CommandLine variable holds the command line arguments.

$ math foo bar
In[1]:= $CommandLine
Out[1]= {math, foo, bar}

Upvotes: 7

Related Questions