Questions tagged [command-line]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5 votes
1 answer
75 views

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

I'm generating an array using Mathematica which produces a single .dat file. I then use SFTP/SCP to transfer it to the staff Linux cluster. This isn't a particularly difficult task but is there a way ...
0 votes
0 answers
46 views

How to abort an evaluation in the terminal [closed]

I am running Mathematica 13.1 via the terminal over SSH on my university's computing cluster, inputting the commands interactively in the terminal, not via a frontend. However, sometimes (perhaps due ...
1 vote
2 answers
112 views

Execute .nb from command prompt on Windows 10

I have a file script.nb which outputs a .png that I need to run regularly from command prompt on Windows 10. From searching ...
1 vote
1 answer
69 views

Execute script in text mode and keep interpreter open

I'm on linux using Mathematica 12.1.1 in text mode, i.e. command line. How do I execute a script (which for me just means a text file with valid Mathematica expressions in it), display the results and ...
2 votes
4 answers
210 views

what's the Mathematica command for a recursive formula?

I want to know the Mathematica command for $$f(a)=\sum_{n=0}^{a-1} \frac{f(n)}{n!}, \quad f(0)=1$$ How to write $f(0)=1$ together with the summation? I used: ...
-2 votes
1 answer
90 views

How to find the Mathematica command for the function $a_k?$ [closed]

I am trying to find the $n$-th derivative of $\csc(m\pi)$, so I took few cases: for simplicity let $x=\cot(m\pi)$ and $y=\csc(m\pi)$, $$\frac{d^0}{dm^0}\csc(m\pi)=\pi^0(\color{red}{1}x^0y^1)$$ $$\frac{...
-1 votes
1 answer
53 views

what is the Mathematica command for the Euler numbers $E_k?$ [closed]

We know that the Euler numbers $(E_r)$ has many integral and series representations but I am wondering if there is a simpler Mathematica command.
1 vote
1 answer
118 views

Evaluating a mathematica notebook via the command line and saving the evaluated file

I am attempting to evaluate a notebook with the following code via the command line ...
0 votes
0 answers
50 views

Is there a way to access the previous evaluations (%, %%, ...) in a Wolfram Language Script when run from the command line?

In this example of a .wls file, I attempt to retrieve the output of the last evaluation (the string "Hello world") and print it just as in a notebook: This works when I open the file with ...
  • 483
0 votes
0 answers
30 views

How do I call command-line tools from a standalone java library using WL?

I have the following command which when I run on the windows command line, works perfectly fine. ...
  • 8,417
1 vote
1 answer
81 views

Is it possible to do grid like printing on commandline when executing scripts on Ubuntu?

I am executing scripts on command line (cli) using wolfram -script code.m. However I couldn't find a solution that can print data in a grid like or fixed-width ...
  • 912
1 vote
1 answer
75 views

How can I define a shortcut key to clear all the variables defined so far?

In my computation I often use the command ClearAll["Global*"] to eliminate all the variables I have defined so far. But to input stroke by stroke is ...
  • 443
1 vote
0 answers
68 views

Exit Wolframscript by Ctrl+C without interrupt prompt

How can a Wolframscript be terminated by Ctrl+C without yielding the Interrupt prompt (see e.g. here)? Unfortunately, this self-proclaimed hack causes a ...
1 vote
0 answers
88 views

Wolfram script does not work due to memory shortage and/or "license error" (FacialFeatures function)

I am trying to run a wolfram script on my windows cmd prompt. The script (available here) uses the function Facial Features of Mathematica. It is important to highlight that I need to process this ...
  • 17
0 votes
1 answer
67 views

Running a wolframscript on the cmd prompt: error message related to "shadowed" definitions

I am trying to use a wolfram script to analyse a large number of movie frames (script available here:https://community.wolfram.com/groups/-/m/t/2288529) I am using the following code on the Windows ...
  • 17
0 votes
1 answer
141 views

Difficulty to run a Wolfram Script (with FacialFeature function) on Windows Command Line

I am on Windows. I am working on a project which consists in analysing a very high number of images. More precisely, I am using the FacialFeatures function of Mathematica to quantify the visibility of ...
  • 17
18 votes
2 answers
404 views

How to create a CLI for Wolfram language scripts?

Former question: How to use wolframscript to develop flexible command-line tools? I am currently changing a notebook into a wolframscript for a "production" environment, where I plan to ...
  • 678
4 votes
2 answers
216 views

Check if the license is available otherwise quit

Suppose I launch many parallel Mathematica scripts with a command like #!/bin/bash math -run '<<MyScript.m someparameters' My license has a limited number of ...
  • 748
2 votes
1 answer
213 views

Execute notebook from command line?

Starting with a notebook CDoc.nb that contains one input cell: CreateDocument["\ttest"] If I evaluate this in the ...
  • 13.6k
2 votes
1 answer
82 views

How to ListPlot from Command Line In Math 12?

I almost always use Mathematica from the command line (Mac/Xwindow) and have things set up to plot/display graphics using Preview, which is great. The problem is, some functions like ListPlot don't ...
  • 281
1 vote
0 answers
33 views

In warning messages, can multi-storey expressions be flattened?

I receive the following output in command line: ...
  • 2,940
1 vote
0 answers
69 views

Problem with RunProcess

I'm trying to use the RunProcess function to run docker on Mac OS using Mathematica. But there is a problem: ...
  • 11
1 vote
0 answers
201 views

WolframKernel not found when running WolframScript

While attempting to run wolframscript in linux, I get the error "WolframKernel not found. Use -configure to set WOLFRAMSCRIPT_KERNELPATH Or export WolframKernel=/yourpath/WolframKernel" I am ...
  • 549
1 vote
1 answer
70 views

How to unprotect/see the code of a command in Mathematica [duplicate]

How do you see the code form of a command in Mathematica? I know there is a command in Mathematica, "Unprotect[]", but how do you actually use this?
3 votes
0 answers
118 views

Why can't I authenticate my SSH connection in Mathematica?

I'm trying to SSH into my Cyberpower PDU41001, which is connected to my computer via Ethernet cable. My computer runs Windows 10. I have enabled SSH communication on the device by logging into the IP ...
  • 31
9 votes
1 answer
406 views

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

With Wolfram Language: In[7]:= ExportString["foobar中文", "Base64"] Out[7]= "Zm9vYmFyXDo0ZTJkXDo2NTg3" With the closest command-line software I could think of <...
  • 8,474
0 votes
0 answers
75 views

Parallel Computation: Kill kernels which have completed the jobs while others keep running

I launch 20 parallel kernels in the background using nohup math -run "<<file.m" &> file.out The nature of computation is integration over various ...
0 votes
1 answer
171 views

Problems in running mathematica file in the background

I have converted my Mathematica notebook into .m file and need to run it in the background on a remote server. I am launching the run from my laptop, on a remote workstation. I need it to obey the ...
2 votes
0 answers
85 views

J/Link with Environment Variables and Command-Line Parameters

I have inherited a large number of Java files with classes I am trying to call from Mathematica via J/Link. They are legacy and am not at liberty to modify. A few are used on command-line scripts (...
  • 31
2 votes
1 answer
326 views

Can't save output in the script mode

I encounter the problem that I can't save any output from Mathematica script. Here is a minimal example. test.m ...
2 votes
2 answers
162 views

is there something like a "foreach" mode from the command line? Like in perl?

With perl we can run perl -p . That wraps a foreach loop around the code and executes the code on the file. What I'm looking for is something like StringReplace[filename,"\t"->","] and then I get a ...
9 votes
1 answer
222 views

Importing Packages to .wls without shadow definitions and context specification

I am trying to import a package that works correctly when I use it in a notebook in a wolframscript .wls. I get a weird shadowing problem, however. Here is a minimal working example ...
  • 5,484
2 votes
0 answers
171 views

Arrow key problem with mathematica 12 and bash version 5

I want to know if anyone experiences the issue with mathematica-12 with bash-5? I am using the command line interface of mathematica. Now when I do up arrow or down arrow to go to history, it does ...
  • 1,468
1 vote
0 answers
69 views

Unable to execute Wolfram script by calling a package

I am working on a script which loads a package called test. When I try to run the same from my command line, I am seeing my input printed without execution. ...
  • 11
0 votes
0 answers
122 views

Readable formula output on command line

I was trying to solve some differential equations. Mathematica is a little expensive to me, so I went for the free Wolfram Engine for Developers. It is said that the engine offers the full power of ...
  • 269
7 votes
2 answers
520 views

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

I'd like to emulate ls -tlra | grep <search term> in Wolfram. I have tried ...
  • 2,995
4 votes
2 answers
139 views

Run retrieving stdout without using RunProcess

Is it possible to run a complex terminal command and retrieve its output. I understand that RunProcess could do this but it cannot directly execute full command and it seems rather complex to rewrite ...
  • 3,703
2 votes
1 answer
168 views

How to change the terminal size programmatically that is opened by `RunProcess`?

Why isn't the following linux command working from the RunProcess interface? I want to change the terminal size programmatically and then display the information: <...
  • 8,417
3 votes
1 answer
252 views

RunProcess fails when a directory path contains a space

In my "Documents" folder I've created two directories with names "тест" and "тест 2". When I try to use RunProcess for obtaining directory listing for the first ...
3 votes
1 answer
170 views

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

I'm using a command-line interface of Mathematica, or /usr/bin/wolfram. In wrapping this cui program with GNU Readline library, I would like to omit the ...
  • 243
3 votes
1 answer
217 views

Creating flags to use with wolframscript?

Is it possible to create flags to pass arguments into a script with wolframscript? I am trying to pass multiple variables that correlate to specific keys. For example, wolframscript -script ...
  • 549
0 votes
0 answers
129 views

Mathematica on Command Line: graphics errors under Mojave

Running Math 11 (or earlier) under Mac Mojave (10.14.5) from the command line, as soon as I display graphics I get a series of errors that look like this: /BuildRoot/Library/Caches/com.apple.xbs/...
  • 281
1 vote
0 answers
50 views

Command line session Linux from Mathematica

Using RemoteConnect and RemoteRunProcess I can create a remote session such that successive commands are done in the same ...
  • 3,703
0 votes
1 answer
895 views

How to run Mathematica as a .m file

I've created this Dummy.nb file with the code x=2 x+3 and exported it as Dummy.m. Whenever I try to run it on the command line with math -run Dummy.m or math -...
  • 111
4 votes
2 answers
111 views

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

I try to run: wolframscript -code "TeXForm[""2+2""]" But I end up with: TeXForm[2+2] I am using Windows. From my research,...
  • 67
3 votes
0 answers
48 views

Is there a limit to the amount of data that can be Run?

I need this command to work through the WolframKernel and it seems well beyond my understanding why it does not work above a certain amount of data size I'm passing to ...
  • 1,970
3 votes
0 answers
151 views

Not getting any output from mathematica script

I am completely new, so this question may be trivial, but I can't find any answers in the Wolfram documentation. I am playing around with scripting in Mathematica, but I cannot seem to get any type ...
7 votes
1 answer
231 views

How to deal with compound command lines with RunProcess?

Given Windows DOS command input: tasklist|find /i "explorer.exe" How to pass it to ...
  • 2,399
2 votes
0 answers
455 views

Convert .nb to .m with a single script or command line in linux [duplicate]

I have some scripts in ".nb" format and I am more used to launch them in Linux command line in Linux but I need them in ".m" format. Usually I open the ".nb" script with the Mathematica Notebook and ...
  • 442
1 vote
1 answer
57 views

RunProcess Does not Stop

I want to convert a latex file to a pdf file, using Mathematica. To do that, I installed MikTex and the I can run the following command in cmd: lualatex main.txt ...
  • 2,873