Here's a simple script saved in the file hello
#!/usr/local/bin/MathematicaScript -script
Print["Hello world"]
I can then run this file using math -script hello
or,
if the file is set to be executable, ./hello
.
In Windows or OSX, run MathKernel -script hello
It prints
"Hello world"
to the terminal.
How can I change this so it does not print the quotation marks?
Print
for outputting warnings in this superuser question. Is there a better way of printing warnings to the terminal? $\endgroup$ – Simon Jan 25 '12 at 4:17Message
, which seems to be the usual way to handle warnings in Mathematica (I think). $\endgroup$ – David Z Jan 25 '12 at 7:50Messages[General]
does not contain an appropriate message for me to use). $\endgroup$ – Simon Jan 25 '12 at 8:05./hello
should also work on OS X if the script is executable (and you have the right shebang) $\endgroup$ – acl Jan 25 '12 at 10:04