0
$\begingroup$

I've created this Dummy.nb file with the code

x=2
x+3

and exported it as Dummy.m. Whenever I try to run it on the command line with math -run Dummy.m or math -script Dummy.m, a local interactive Mathematica kernel starts up, which is not what I want. It generates this output

Terminal Output

Ideally, I would want to run a notebook on the command line, and have the output evaluated for each cell, but my reading of this stack exchange makes me think that this is unlikely. I know this is a basic question, but how do I run my Mathematica code on the kernel properly.

Thank you for answering!

$\endgroup$
  • 1
    $\begingroup$ WolframScript $\endgroup$ – ktm Mar 11 '19 at 3:46
  • 2
    $\begingroup$ This looks like the common mistake of not making sure cells have been set as initialization cells before exporting to a package. Check your Dummy.m and see if code lines have been commented out (* like this *). $\endgroup$ – J. M.'s technical difficulties Mar 11 '19 at 6:10
  • $\begingroup$ The code was commented out, but then I uncommented it, and it's still not running. $\endgroup$ – Pineapple Mar 13 '19 at 9:04
1
$\begingroup$

Try saving your commands in a text file, then piping it to math.exe:

more dummy.txt | math.exe

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.