execute_command_line
- Date:
09-12-2012
NAME
execute_command_line - run a shell command.
SYNOPSIS
call execute_command_line (command[, wait, exitstat, cmdstat, cmdmsg])
STANDARDS
Fortran 2008
DESCRIPTION
The execute_command_line subroutine runs a shell command and accepts the following arguments:
- command
CHARACTER scalar
command is passed to the shell (/bin/sh) and executed, using the system() C library routine.
- wait
(Optional) LOGICAL scalar
Note that the Cray implementation supports synchronous execution only, so wait should be set to .true., if specified.
If wait has the value .false., then abort processing will be initiated unless the optional cmdstat is present. If cmdstat is present, then command is executed synchronously; if no other error occurs, cmdstat is set to -2 and exitstat is set as described below.
- exitstat
(Optional) INTEGER of default kind.
Contains the integer exit code of command unless an error occurs in any of the child processes created to execute command or in the execution of command itself, in which case exitstat contains a non-zero return code.
- cmdstat
(Optional) INTEGER of default kind
Set to zero if the command was executed, regardless of its exit status. If wait is specified and has value .false., and if cmdstat is present and no other error occurs, then cmdstat is set to -2.
- cmdmsg
(Optional) CHARACTER scalar of default kind
Contains error message if an error has occurred.
EXAMPLES
program test_ecl
integer :: i
call execute_command_line ("prog.exe", exitstat=i)
print *, "Exit status of prog.exe was ", i
end program test_ecl
SEE ALSO
system(3)