Skip to main content
20 votes

Running Mathematica Notebook files in command mode

It is not a good idea to try to run a notebook in command line mode. Whether or not it is possible, it is just not a good idea because notebooks can only be handled by the Front End, which is not a ...
Szabolcs's user avatar
  • 236k
17 votes

How to reproduce Wolfram Language's base64 encoded string with command-line tool?

When you use the "Base64" you are encoding a particular file format. For Export calls the file format is inferred from the file name given, like ...
15 votes
Accepted

Difference between "wolframscript -f" and "wolframscript -script"

The -script mode is an interface to the wolfram.exe's -script mode, which is a command-line version of Get. It essentially rewrites the command line, launches a kernel using the equivalent command, ...
Itai Seggev's user avatar
  • 14.2k
12 votes
Accepted

Using the pipe operator ("|") when executing system commands

For example: ...
Tim Laska's user avatar
  • 16.4k
10 votes
Accepted

How to view an image from command line?

Might be relevant, but this is something I use that uses StartProcess and ProcessConnection. ...
chuy's user avatar
  • 11.2k
10 votes
Accepted

Any ergonomic tools for the command line kernel?

As I said in my comments, it is hard to implement this correctly if you aim for some advanced Dynamic features that work in the command line. However, you can ...
halirutan's user avatar
  • 113k
9 votes
Accepted

How to use shell commands inside mathematica

this works for me under linux: SetDirectory[StringDrop[RunProcess["pwd","StandardOutput"],-1]] ( StringDrop drops a trailing ...
george2079's user avatar
9 votes
Accepted

How to activate Mathematica through remote license server from command line?

I believe the easiest way is to just edit the mathpass file to contain a line that has !server, where ...
Brett Champion's user avatar
8 votes
Accepted

curl in Mathematica, google link-shortener

Many URL* functions overlap with functionality so there there are many ways. Here is an example which returns a list of rules: ...
Kuba's user avatar
  • 137k
8 votes

Running Mathematica Notebook files in command mode

To replicate the Ctrl+A Enter execution behaviour automatically you can run Solve.nb from a package file, say runSolve.m, containing the code below. While Wolfram Language Scripts are straightforward,...
Chris Degnen's user avatar
8 votes
Accepted

Run retrieving stdout without using RunProcess

If you prepend bash -c to your RunProcess command, you can pass ls -ltr | tail -1 as a ...
Tim Laska's user avatar
  • 16.4k
8 votes

Importing Packages to .wls without shadow definitions and context specification

Here's a version of the script that works: #!/usr/bin/env wolframscript -print All -run \'Needs[\"ComputerArithmetic`\"]\' Ulp[1000.] This is a limitation of <...
Itai Seggev's user avatar
  • 14.2k
8 votes

what's the Mathematica command for a recursive formula?

This can be solves as a recurrence. If you subtract an appropriate multiple of f[n-1] from f[n] then ther result of that is ...
Daniel Lichtblau's user avatar
7 votes
Accepted

Determine how Mathematica was started

This question is more complicated that you might expect. Things you can check: Given how you want to use this, the simplest thing may be to just check if ...
Szabolcs's user avatar
  • 236k
7 votes
Accepted

Can we make preread replacements in an *.m* file before being run?

No. In fact, even $PreRead is ignored when reading .m files. What you can do is define a myGet as ...
Itai Seggev's user avatar
  • 14.2k
7 votes
Accepted

How to deal with compound command lines with RunProcess?

RunProcess does not run shell commands (things you might type into your terminal). It runs processes, as the name suggests. If you want to run shell commands, then ...
Szabolcs's user avatar
  • 236k
7 votes

Can I run terminal commands such as SFTP/SSH through a mathematica notebook?

You can use CopyFile with a RemoteFile parameter, including the necessary Authentication ...
rhermans's user avatar
  • 36.9k
6 votes
Accepted

Can we make new definitions for InputForm in packages?

Unfortunately, I don't think there is. The association between characters and symbol names is burned into the kernel (in the form of a "yacc" grammar), with complete information about associativity, ...
Itai Seggev's user avatar
  • 14.2k
6 votes
Accepted

Problem calling Python scripts from Mathematica

To make the path permanently available to Mathematica (frontend) and all other applications, first find out the location of your desired python3 executable (e.g. ...
Jens's user avatar
  • 97.6k
6 votes

Textual progress in console?

Here is a crude progress bar demo script that has been tested in a Gnome terminal under Linux and a Powershell command prompt under Windows 10. Don't expect much because it's only a loop with a print ...
LouisB's user avatar
  • 12.6k
6 votes
Accepted

How to recover WolframScript's former `-run` functionality?

This is an execution mode I don't think we encountered in internal testing for the new wolframscript, the thought being that such processing would occur early in the script, an any needed values would ...
Itai Seggev's user avatar
  • 14.2k
6 votes

How to view an image from command line?

As long you've set X11 forwarding correctly JavaGraphics should work just fine. I.e, ssh -Y remote followed by ...
Itai Seggev's user avatar
  • 14.2k
6 votes
Accepted

FindRoot fails 100 iteration precision

You can ask Mathematica if it can tell you something about your function and in particular if it is going to be negative somewhere ...
halirutan's user avatar
  • 113k
6 votes

Any ergonomic tools for the command line kernel?

I have implemented a relatively bare-bones textual frontend for Mathematica called MathLine. It offers Readline-like text input (uses linenoise), which means command history and emacs-style editing. ...
Robert Jacobson's user avatar
6 votes
Accepted

Creating flags to use with wolframscript?

I suspect you have to write a script (in Unix/Linux/OSX style) that uses wolframscript as the shell in order to be able to process arbitrary flags from the command ...
kirma's user avatar
  • 19.1k
6 votes
Accepted

Is there a way to omit the "In[1]:=" prompt?

You may be able to use some code like this ...
Somos's user avatar
  • 4,917
6 votes
Accepted

what's the Mathematica command for a recursive formula?

I would define f[0] = 1; f[n_ /; n >= 1] := f[n] = Sum[f[i]/i!, {i, 0, n - 1}] This uses memoisation, which is not strictly necessary, but avoids unnecessary ...
mikado's user avatar
  • 16.8k
5 votes

Linux’s Bash shell in Windows 10 and mathematica

As we also know from a number of sources, bash-over-windows-10 is in beta, not yet feature complete, and it is not really meant to interface with Windows apps at the moment. If you can get a command ...
Emilio Pisanty's user avatar
5 votes

How to execute a Mathematica notebook in a shell script to produce plots/graphics

Since the answer is found not in a single 'duplicate', but multiple ones, here's a summary: Do not use notebooks. Transfer the code to a plain text .m file. You ...
Szabolcs's user avatar
  • 236k
5 votes
Accepted

How do I get TexForm to work on the command line? (Windows only)

try this? ...
Jerry's user avatar
  • 2,469

Only top scored, non community-wiki answers of a minimum length are eligible