With the 10.4 version of WolframScript
, I could run something like
$ WolframScript -run <CODE> -script /path/to/script.wl [ARGS...]
...where <CODE>
stands for some arbitrary WL expression.
The command above would evaluate <CODE>
, and then run /path/to/script.wl
.
This functionality was broken with version 11.
For example, if simple_script.wl
consists of a single line:
Echo[First @ $Path];
...then, with version 10.4 I get results consistent with the description given earlier, namely:
$ WolframScript -run '$Path=DeleteDuplicates @ Prepend[$Path, "/my/mma/lib"];' \
-script simple_script.wl
>> /my/mma/lib
...but with version 11.1, the same command-line above results in
Wolfram Language 11.1.0 Engine for Linux x86 (64-bit)
Copyright 1988-2017 Wolfram Research, Inc.
ToExpression::sntx: Invalid syntax in or before "= ".
^
In[1]:=
Quit
sh: 1: -script: not found
I.e., with version 11.1, the command-line above
- runs into a syntax error (who knows why);
- starts an interactive session (in text-mode);
- never executes
simple_script.wl
; in fact, there appears to be an attempt (by what?) to execute, as a subsequent shell command, the tail of the original command-line starting with-script
.
This loss of functionality breaks a couple dozen analysis pipelines (many man-months worth of work), so I'd like to find a reasonable work-around that does not require retooling all this code.
Is there a way to recover the functionality described above with version 11.1 of WolframScript
?
P.S. I'm aware of the new -code
flag, but the latest version of WolframScript
recognizes only the first of -code
and -script
it finds on the command-line, not both.