EXECUTE_COMMAND_LINE intrinsic subroutine

Standard: F77 F90 F95 F2003 F2008 Example program


<Syntax>

Call EXECUTE_COMMAND_LINE ( COMMAND [ , WAIT, EXITSTAT, CMDSTAT, CMDMSG ] )

COMMAND : Default character scalar;
WAIT : Default logical scalar;
EXITSTAT : Default integer scalar variable;
CMDSTAT : Default integer scalar variable;
CMDMSG : Default character scalar variable.

<Semantics>

The command given by COMMAND is executed by the default system command processor. The other arguments are all optional; when present, they act as follows.

WAIT indicates whether to wait for the command to finish executing; the default is true. Note that WAIT=.FALSE. is not supported by Release 7.0 of the NAG Fortran Compiler; it will cause an error to be returned through CMDSTAT, or if CMDSTAT is not present, it will cause error termination.

EXITSTAT receives the exit status of the command (only if the command is executed synchronously, otherwise it is unchanged). The meaning of the exit status is operating system (and command) dependent.

CMDSTAT is set to −2 if WAIT=.FALSE. is given, an operating system error code if an unexpected error occurs, and to zero otherwise. (The value −1 is reserved for indicating when the Fortran compiler does not support command execution.) If CMDSTAT is not present and any error occurs, the program is terminated.

CMDMSG is set to an appropriate message if an error occurs, and is unchanged if no error occurs; note that CMDSTAT must also be present to avoid program termination on any error.

<Related>