system

The system() function is used to run commands on the policy server host as part of the policy. The Privilege Management for Unix and Linux variable status is set to the return code of the command upon exit. By default, commands that are run by the system() function are run as root. However, commands can be run as different users by setting the Privilege Management for Unix and Linux variable subprocuser.

Input to the command comes from the user’s keyboard or from the inputstring if it is present. Output goes to the user’s screen or to the result string variable, if present.

Do not use system() without the result variable in a policy that is processing pbguid requests.

[result =] system (command [,inputstring]);
command Required. The command to run.
inputstring Optional. Command input arguments, formatted into a single character string.

result contains the output of the command. If the result variable is not specified, the output from the command that is executed by the system() function appears on stderr of the requesting program (pbrun, pbsh, pbksh).

The Privilege Management for Unix and Linux variable status is set to the return code. In general, a return code of 0 means the command completed successfully. For a description of non-zero return codes, see the documentation for the command that is being run.

result = system ("echo date");

In this example, result is assigned date\n because the echo command outputs the string date with a newline character.

For more information, please see the following: