Issuing commands from a terminal

Hi,

Working on a workflow where Igor loads and fits data and returns a file with fitted parameters.  I have something working but wanted to double check on the formatting of the terminal level command.  Within Igor from the command line I can issue

process_data("Path_toFile")

all works as expected

In terminal (on a Mac in this case) the command issued looks like this

"Path_To_igor" /X 'process_data("Path_toFile")'

Note the quotations around the command issued.  Process_data(string input) is a function I wrote that runs the internal workings.

If I omit the quotations around the command, I get an error

"invalid mode specification"

However when testing initially for the connection to Igor from the terminal I used:

"Path_To_igor" /X beep

or

"Path_To_igor" /X make lucy

Notice no quotations around the command even the name of the wave to be created

Is this expected behavior and if so what is the decision factor on whether to have quoted commands or not?

Andy

does the first single quote act as an escape for the double quotes around Path_toFile?

so

"Path_To_igor" /X make lucy

doesn't need quotes, but

"Path_To_igor" /X 'make $"lucy"'

does?

Hi,

My path to Igor on the Mac is

'/Applications/Igor Pro 9 Folder/Igor64.app/Contents/MacOS/Igor64'  and the quotes are needed because of the spaces in the path name that would otherwise confuse the shell script.

If I issue this command to make a wave of length 12 named lucy

'/Applications/Igor Pro 9 Folder/Igor64.app/Contents/MacOS/Igor64' /x make /n=12 lucy

This works and the history window shows this

Command line: make /n=12 lucy 

If however I issue the standard time() command

'/Applications/Igor Pro 9 Folder/Igor64.app/Contents/MacOS/Igor64' /x time()

The zsh shell script seems to take over and I get a new prompt in the terminal

function>

instead of the previous

(base) andreashegedus@Andys-iMac ~ %

control-c gets you back to the usual prompt.

Now if I issue this simple print command

'/Applications/Igor Pro 9 Folder/Igor64.app/Contents/MacOS/Igor64' /x print("hello World")

I get an error:

zsh: unknown file attribute: h

If I recast the print command to have quotes around it - note single quotes

'/Applications/Igor Pro 9 Folder/Igor64.app/Contents/MacOS/Igor64' /x 'print("hello World")'

This works with both the command and result being printed

•Command line: print("hello World") 
  hello World

At this stage I think it is not an Igor issue but rather a zsh shell script issue and the going forward plan is to encapsulate everything in quotes.

Andy

If you don't do anything else, the double quotes are interpreted by the shell. If I issue this command in terminal:

/Applications/Igors/Igor\ Pro\ 9.01\ Folder/Igor64.app/Contents/MacOS/Igor64 /X print "Hello"

Igor starts up, but I get this error:

Note that the command lacks the quotes, which were interpreted and removed by the shell.

If I use this command (note escaped quotes):

/Applications/Igors/Igor\ Pro\ 9.01\ Folder/Igor64.app/Contents/MacOS/Igor64 /X print \"Hello\"

I get what I wanted: Igor prints Hello into the history.

I could also use single quotes around the entire command string- that tells the shell that it shouldn't try to interpret anything within the command string.

ExecuteError.png (65.49 KB)