I have a very useful bash script for pre-processing a Mathematica notebook before committing it to my local git repo. It works fine under Windows/Cygwin and under Linux. I like to keep one master copy of the script in the git directory for my project and create a symbolic link to this one copy in any other directory in which I want to run it.
I'd like to be able to do the same under WSL/Ubuntu but I can't get that to work.
The essence of the problem can be demonstrated from a Windows terminal running WSL/Ubuntu by means of the following highly simplified example:
Create an executable script file named test.sh
containing the lines
#!/usr/bin/env wolframscript
Print["2+2 = ",2+2]
in ~/demo/subdir
.
Create a symbolic link to it in ~/demo
like this
ln -s ~/demo/subdir/test.sh ~/demo/test.sh
When I execute ./test.sh
from ~/demo/subdir
the resultant output is
2+2 = 4
So far, so good.
However, if I execute ./test.sh
from ~/demo
, WolframScript pops up in interactive mode instead and I see this
Wolfram Language 13.0.0 Engine for Microsoft Windows (64-bit)
Copyright 1988-2021 Wolfram Research, Inc.
In[1]:=
FWIW, the following results related to the name "wolframscript" obtain:
:~/demo$ alias wolframscript
-bash: alias: wolframscript: not found
:~/demo$ which wolframscript
/usr/bin/wolframscript
:~/demo$ whereis wolframscript
wolframscript: /usr/bin/wolframscript
:~/demo$ ls -l /usr/bin/wolframscript
lrwxrwxrwx 1 root root 69 Mar 1 11:21 /usr/bin/wolframscript -> '/mnt/c/Program Files/Wolfram Research/WolframScript/wolframscript.exe'
As stated previously, the above works fine in both cases when using Windows/Cygwin or Linux.
I'm looking to understand why this happens with WSL/Ubuntu and hoping for a workaround requiring relatively minor changes to my actual, already-working, multi-platform script.