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

坚强是说给别人听的谎言 提交于 2019-12-12 12:35:50

问题


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).


回答1:


The $CommandLine variable holds the command line arguments.

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


来源:https://stackoverflow.com/questions/7149252/if-doing-math-foo-bar-how-to-get-foo-and-bar-inside-mathematica

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!