Running a shell (bash) script, with multiple arguments

Discussion created by michaebriordan on Aug 17, 2017
Latest reply on Aug 20, 2017 by michaebriordan



This is infuriating me. I have a Mac shell script which uploads files to a server. The script works perfectly in testing, but I am unable to pass it any arguments from Filemaker. It needs two arguments from Filemaker to generate a filename, both of which have spaces.


I have tried, and failed to get Filemaker to call Applescript, to do a shell script, with arguments, by escaping and otherwise, but cannot get Filemaker and Applescript to send arguments with spaces to the Mac shell...


Here's what I want to do:


do shell script "~/uploadPDF.sh" "first argument from field 1" "second argument from field 2"


where the values of field 1 and field 2 both have spaces, and therefore need to be quoted when passed to the shell.


Additionally, I would then like to put the return value of the script in field 3. I have tried the suggestion here: Need to run a an OS X terminal command and grab result - "set cell \"dig_results\" of current record to do shell script \"dig " & yourfile::dig_server & " " & yourfile::dig_type & "\"" - but can't get it to work.


Any suggestions  would be helpful. I have tried escaping with slashes (\), but I'm getting very confused over where the escaping is being interpreted...