Performs a command line script of the command parameter. Essentially the same as using Terminal on the Mac, or CMD.exe on Windows.

Using a timeout value of -1 will wait forever or until the command finishes. This is also equivalent to passing the parameter with only the command and no timeout parameter.
A timeout value of 0 or and empty parameter "" will return to FileMaker immediately and will always return the error code 12000 - timeout exceeded.
Any other timeout value will wait a maximum of the time in milliseconds or when the command finishes, whichever is first. This is the same as if the parameter was left out.
theexecuteUsingShell default is true, which means you can include multiple commands in a single command, like you would on unix. Plus it has access to the shell environment variables etc. Setting to false will require full paths, but can be more compatible. Setting this to false is gets the same compatibility as the 4.0.6 through 4.1.4 versions.


- command : the content of the command to run

- timeout : A value, in milliseconds that the plugin should wait for a result before returning.

- executeUsingShell : (defaults to true ) whether to execute the command directly or in a shell


Execute System Command Shell

Version History:

- 2.0.0 : Added.

- 4.0.6 : Switched to a different library, which broke a lot of things, and meant it could only run one command at a time.

- 4.1.3 : Do not crash when attempting to execute an empty command. MacOS, Linux and iOS enable multiple calls to shell like version 4.0.5.

- 4.2.0 : Reverted back to the 4.0.5 and fixed the crash issue, and added executeUsingShell as an option.


- On the Mac this uses the "sh" shell, which is different from the default shell which is "bash". There can be syntax differences between commands using these shells, so if you find a difference between the two, first try running BE_ExecuteSystemCommand ( "/bin/bash -c \"commandhere\"" ) to see if that removes the difference.

- You can also string multiple commands together in a single plugin function call by using Char ( 10 ) on Mac and Char ( 13 ) on Windows as command separators, but only when using executeUsingShell set to True/1.

- On Mac and Linux, there can be differences between what this function does and a terminal session directly. On FMS that's most likely due to permissions because the processes run as the fmserver user, and so doesn't even have access to programs and folders outside of fms itself.

- The other very common issue is that the plugin doesn't launch with the same shell as a regular user, and can have very different environment variables, so a executable call might fail because it's not referenced in the path. Run the printenv command from the terminal and also from the BE plugin and compare the two, to see if there are differences in paths for example. You can work around path issues by declaring them in the shell commands, or by using full paths to executables.

Still need help? Contact Us Contact Us