- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can anyone explain how to store a value returns by a linux command in a fortran local variable without using IO operations.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The standard Fortran intrinsic EXECUTE_COMMAND_LINE does this.
An example:
integer stat call EXECUTE_COMMAND_LINE('ls',EXITSTAT=stat)
For Intel Fortran this will require compiler version 15.0.1 or later.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Mr.Steve.But if I want to store the output of the linux command 'whoami' in a fortran variable,What should I do?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah, you want to save the output. There's no way I know of to do this without using I/O. However, for this particular purpose I think that the POSIX subroutine PXFGETLOGIN might do what you want.
PXFGETLOGIN

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