4
$\begingroup$

I have the following .m file

(* ::Package:: *)
(* ::Input:: *)
(*out=1+1;*)
(*Print["Test"];*)
(*Export["/path/test.txt",out];*)

and I am trying to run it in the terminal with math -run -nomprompt < name.m

but it doesn't work. I have changed the permissions of the .m file.

$\endgroup$
1
  • 1
    $\begingroup$ It works for me when I uncomment the last 3 lines of the code, recognizing that -nomprompt contains a typo. $\endgroup$ – LouisB Apr 9 '20 at 19:26
0
$\begingroup$

Solution: They have to be initialization cells to be able to run them.

$\endgroup$
1
  • 2
    $\begingroup$ They have to be initialization cells to not export as comments in the autogenerated .m file $\endgroup$ – b3m2a1 Apr 9 '20 at 22:20

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.