Use Wolfram Language in a command-line interface with the WolframScript command-line script interpreter.
With Code in the Command Line...
Run Wolfram Language code directly in a command-line interface with the WolframScript -code option:
With Code from a File...
Create a file of Wolfram Language code:
Run the code in the file:
- Use Print to produce an output from code in a file. The value of the last expression in a file is not returned by default, as in the notebook interface.
- If the code in a file does not explicitly print a result, you can nevertheless cause the last output to be printed with the WolframScript -print option.
With Execution in the Wolfram Cloud...
If you do not have a local installation of the Wolfram System, you can still run Wolfram Language code from the command line in the Wolfram Cloud:
- If you are not already logged into the Wolfram Cloud, the first time you run WolframScript in the cloud, you will be asked to authenticate. Subsequent invocations of WolframScript will not require you to authenticate again.
- If there is no local installation of the Wolfram System, WolframScript will automatically execute in the Wolfram Cloud.
- In bash and other Unix shells, single quotes disable all special characters, including $ and `.
- On Windows, disable special characters by wrapping command-line arguments with double quotation marks.