Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Run Shell Script won't return results

Featured Replies

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.

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.

  • Author

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}'"

  • Author

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!

Your True should be "true" (lower case t) and put in quotes so that it is passed as a literal string.

  • Author

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)!

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.