- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, everyone. I want to run a bash command within a Fortran program. I notice there are two functions named "system" and "systemqq" to do this. However, the IFPORT module is required. Is there any intrinsic functions or subroutines to do this without using the IFPORT module?
Thanks in advance!
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are no system call functions specified by any of the Fortran standards that I am aware of. System calls are always provided by compiler extensions, making them somewhat non-portable. So the answer to your question is no, there are no intrinsic functions or subroutines to do this. You can follow the Intel Compiler documentation to make a system call, or perhaps, you could write it in C and then call it from your Fortran program, which could end up being more portable. (Disclaimer: My experience with c is very limited.)
Good Luck,
Z
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are no system call functions specified by any of the Fortran standards that I am aware of. System calls are always provided by compiler extensions, making them somewhat non-portable. So the answer to your question is no, there are no intrinsic functions or subroutines to do this. You can follow the Intel Compiler documentation to make a system call, or perhaps, you could write it in C and then call it from your Fortran program, which could end up being more portable. (Disclaimer: My experience with c is very limited.)
Good Luck,
Z
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Z!
I think I will use the functions "system" or "systemqq" in ifport module.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will note that Fortran 2008 specifies an EXECUTE_COMMAND_LINE intrinsic, so this will eventually be coming to a Fortran compiler near you. I can't predict what "eventually" means as far as Intel Fortran goes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's glad to know this. Nevertheless, "system" and "systemqq" in IFPORT module work well for my simple case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
SYSTEM and SYSTEMQQ are executed in an isolated shell (not in the one under which your program runs). If you need/want to execute a command in the same environment, RUNQQ is a better option.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page