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$
3
  • 1
    $\begingroup$ WolframScript $\endgroup$
    – ktm
    Commented Mar 11, 2019 at 3:46
  • 3
    $\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$ Commented Mar 11, 2019 at 6:10
  • $\begingroup$ The code was commented out, but then I uncommented it, and it's still not running. $\endgroup$
    – Pineapple
    Commented Mar 13, 2019 at 9:04

1 Answer 1

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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