EXECUTE_COMMAND_LINE — Execute a shell command#
-
EXECUTE_COMMAND_LINE(COMMAND, WAIT, EXITSTAT, CMDSTAT, CMDMSG)#
EXECUTE_COMMAND_LINEruns a shell command, synchronously or asynchronously.- Parameters:
COMMAND – Shall be a default
CHARACTERscalar.WAIT – (Optional) Shall be a default
LOGICALscalar.EXITSTAT – (Optional) Shall be an
INTEGERof the default kind.CMDSTAT – (Optional) Shall be an
INTEGERof the default kind.CMDMSG – (Optional) Shall be an
CHARACTERscalar of the default kind.
- Standard:
Fortran 2008 and later
- Class:
Subroutine
- Syntax:
CALL EXECUTE_COMMAND_LINE(COMMAND [, WAIT, EXITSTAT, CMDSTAT, CMDMSG ])
- Example:
program test_exec integer :: i call execute_command_line ("external_prog.exe", exitstat=i) print *, "Exit status of external_prog.exe was ", i call execute_command_line ("reindex_files.exe", wait=.false.) print *, "Now reindexing files in the background" end program test_exec
- Note:
Because this intrinsic is implemented in terms of the
systemfunction call, its behavior with respect to signaling is processor dependent. In particular, on POSIX-compliant systems, the SIGINT and SIGQUIT signals will be ignored, and the SIGCHLD will be blocked. As such, if the parent process is terminated, the child process might not be terminated alongside.- See also: