Open Metric
Science, Fiction and Me

Today I Learned

How to Run Mathematica Script in Terminal

A Mathematica script that can be run though ssh should be pure script like a .m file of Mathematica.

To run it, the following command is used.

math -run "<<my-mathematica-script.m"

or

math -run < my-mathematica-script.m

After math executes the script, it falls back to the REPL interface. If this is not useful at all, we apply -noprompt.

math -run -noprompt "<<my-mathematica-script.m"

Combined with nohup and screen we can run a Mathematica script in the background.

nohup math -run "<<my-mathematica-script.m" &> my-mathematica-script.out&

A Random #TIL# for You


Most technical TILs will be updated at datumorphism.leima.is/til

By OctoMiao

Last updated