module shell_command {
string+read+req command;
int+read active;
int+read on_inst;
char+write stdout[];
<user parameters>};
shell_command executes a specified command string and places any data output by that string into the stdout array. The command string is executed synchronously: while the command is running, the module is running.
The command string can take additional user-defined parameters. Because the update method for the shell_command module has the no_meth_ctx property set to 1, these parameters can cause the update method to execute when they change. When the command string is processed, the string values of these parameters are substituted into the command string.
The command parameter specifies a string that contains the command as it is delivered to the shell on your system. This shell command can contain variables delimited by the at (@) character. The names of the variables are resolved to be names of parameters that you have added to the module. For example, you might define the shell_command module in V like:
shell_command ls_command {
command = "ls @my_dir";
string my_dir = "/tmp/";
};
In this example, as the my_dir parameter's value changes, the update method runs and the command is executed. You can set the nonotify attribute on a parameter that you add to prevent it from causing the method to run.
When set to 0, this parameter disables the execution of the command. You can use this to prevent the command from being executed as the command or other parameters are being changed.
When set to 0, this parameter prevents the execution of the shell command in response to the instance event.
This is a binary array of characters that are derived from the standard output stream of the executed command.