TCL script "exec" command usage and parameters
In TCL scripts, the "exec" command is used to send text strings to the Fortigates and Fortigate output is then returned to the TCL script which can then be processed by TCL.
A typical example would look like:
exec "get system status\n" "# " 10
The first parameter is the text to be sent to the Fortigate with \n being the new line character used to terminate the command.
The second parameter (in the above case, "# ") is the string that the Fortigate should return to exec which exec should wait for before moving on.
The third parameter (in the above case, 10) is (perhaps suspected to be) the timeout value which tells exec to wait up to 10 seconds for the "# " string to be returned by the Fortigate before exec will give up waiting and move on.
However, I have searched for details on the second and third parameters and have not been able to confirm the precise usage requirements for either parameters.
In the case of the second parameter - the matching string. Is the string a regex or just a simple text string?
For example, is the following a valid exec command? Note the second parameter. Since it is a regex, it should match on both # and on $. If the string is not a regex, can it be a comma delimited string to match on different strings. Or is the value restricted to just one string?
exec "$cmd\n" " (#|\$) " 10
In the case of the third parameter - the suspected timeout. What is the valid range of values? For example, are the following exec commands valid? Note the third parameter. They are set to 5 and 20 (seconds) .
exec "$cmd\n" " (#|\$) " 5 exec "$cmd\n" " (#|\$|>) " 20
Are there any other values that are valid for the second and third parameters?
Do you have any other details of correct operation and use of the exec command?
