When I created a Mathematica script, I found that all my lines were commented out (when opened with vi or gedit or any other text editor). So I either need to get rid of the (**) manually or through a bash script before I run my Mathematica script from a unix terminal.
To create my script, I include the shebang #!/usr/local/bin/MathematicaScript -script on the first line and then save my file as a .m package. The resulting file looks something like this:
(* ::Package:: *)
(* ::Input:: *)
(*#!/usr/local/bin/MathematicaScript-script*)
(* ::Input:: *)
(**)
(*f[x_] := x*)
Why are my lines commented? Is there anything I need to do?
.nbnotebook, then just save the notebook as a.mpackage. – murray Aug 27 '12 at 22:15.mpackage directly. – Yves Klett Aug 28 '12 at 05:03.mfiles from the command line is fantastic and helps with running code while one is asleep!:P– dearN Aug 28 '12 at 13:40.mfiles. You can get to it by going toFile > New > Packageor if you open a.mfile in Mathematica (notice it looks different from your usual front end notebook). This has nothing to do with how the file is run – rm -rf Aug 28 '12 at 14:18