Mathematica API Notes

From myWiki

Save the following as input.m

SetOptions[Plot,DisplayFunction->Identity]
a=Plot[Cos[2*x],{x,0,Pi}]
Export["plot.png",a]
Exit[]

The following can be run from the command line in /opt/Wolfram/WolframEngine/10.0/Executables

./math -run "<<input.m"