Jump to content

Run Shell Script won't return results


This topic is 4783 days old. Please don't post here. Open a new topic instead.

Recommended Posts

OSX 10.6 - FMPA 11v2 - ScriptMaster 4.122

IIf I use the Run Shell Script test in ScriptMaster DB, I do get the results displayed, but when in a script using a Set Variable [( Run Shell Script ( "my shell script" ; true ; 30 )] my results are "Executed shell command: my shell script". Not sure what I'm missing between the SM demo file and my script step?

The actual shell script is checking if a file is locked by being open in another application. So I'm first using Select File get the file path, then creating a script variable of the shell script with the path embedded. The final shell script looks like this:

fuser /Users/me/Desktop/test.xlsx | awk -F: '{print $NF}'

This should return a pair of numbers if the file is locked and a single number if it is not locked. Again, if I copy the shell script into the SM demo file it works great, but I don't get the same results when setting either a variable or a field.

Link to comment
Share on other sites

can you post your script here? The result you're getting doesn't sound like something the module would return, so I suspect that something else in your script may be setting that message that you are receiving.

Link to comment
Share on other sites

Sure, here is the script after I have loaded both the SelectFile and RunShellScript functions:

# Select file to test and create shell script

Set Variable [ $MySelectedFile; Value:SelectFile ]

Set Variable [ $script; Value:"fuser " & $MySelectedFile & " | awk -F: '{print $NF}'" ]

#

# Run shell script

Set Variable [ $runScript; Value:RunShellScript ( $script ; True; 30 ) ]

#

Exit Script [ ]

The value in $runScript ends up being "Executed shell command: fuser /Users/me/Desktop/test.xlsx | awk -F: '{print $NF}'"

Link to comment
Share on other sites

Looking at the RunShellScript code it looks like the results I'm getting are when the waitForOutput has been set to false. I've tried quoting the true parameter, and using 1 instead of true - no difference. I'm sure I'm missing something simple, just not sure what that is!

Link to comment
Share on other sites

OK - now I feel really stupid! I know I have tried using "true" a number of times, but now it's working. I guess it just needed your blessing!

Thank you (for the obvious, or what should have been)!

Link to comment
Share on other sites

This topic is 4783 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.