
do shell script

joe61vette
Hello Again:
I am trying to use ExecuteUnixShellCommand to launch a unix app. Here is the output:
•RunTests("PH", "TAMU", 0.3) Unix command: cd '/Users/joe/Documents/Current Work/Kairos/V&V/Pressure_Drop';mpiexec -n 6 /Users/joe/projects/pronghorn/pronghorn-opt -i test.i do shell script "cd '/Users/joe/Documents/Current Work/Kairos/V&V/Pressure_Drop';mpiexec -n 6 /Users/joe/projects/pronghorn/pronghorn-opt -i test.i" sh: mpiexec: command not found
You'll note that I had to use single quotes to get around the space and the & in the path name. If I just simply copy the unix command and paste it into a terminal window, all works great. The directory is changed and the app runs. But for some reason, when using do shell script, it doesn't recognize mpiexec as a command.
I am running Igor 8.02 on an Intel Mac with Big Sur 11.5.2. Here is ExecuteUnixShellCommand with a debug print statement:
Function/S ExecuteUnixShellCommand(uCommand, printCommandInHistory, printResultInHistory) String uCommand // Unix command to execute Variable printCommandInHistory Variable printResultInHistory if (printCommandInHistory) printf "Unix command: %s\r", uCommand endif String cmd sprintf cmd, "do shell script \"%s\"", uCommand ExecuteScriptText/UNQ/Z cmd // /UNQ removes quotes surrounding reply Print cmd if (printResultInHistory) Print S_value endif return S_value End
Thanks for the help,
Joe Kelly
Possibly the directory containing mpiexec is not in the PATH environment variable when Igor is running.
Execute this in Terminal:
echo $PATH
Then execute this in Igor:
Print GetEnvironmentVariable("PATH")
You can use this in Terminal to find the directory:
which mpiexec
and then use a full path in the ExecuteScriptText command.
August 18, 2021 at 11:15 am - Permalink
If you cd into the directory you could also invoke an executable with "./mpiexec" without changing the PATH.
August 18, 2021 at 11:27 am - Permalink
In reply to Possibly the directory… by hrodstein
Thanks again Howard. Using the full path did the trick.
Joe
August 18, 2021 at 11:31 am - Permalink