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$Message
, which seems to be the usual way to handle warnings in Mathematica (I think). $\endgroup$Messages[General]
does not contain an appropriate message for me to use). $\endgroup$./hello
should also work on OS X if the script is executable (and you have the right shebang) $\endgroup$