Go to main content
Oracle Developer Studio 12.5 Man Pages

Exit Print View

Updated: June 2017
 
 

sh(3F)

Name

sh - fast execution of an sh shell command

Synopsis

integer function sh (string)
character*(*) string

Description

The function sh gives string to the sh shell as input, as if the string had been typed as a command.

The shell is always the Bourne shell, sh(1).

The current process waits until the command terminates. The returned value is the exit status of the shell. See wait(2) for an explanation of this value.

The functions sh and system(3F) pass the argument string to a shell for execution. They convert the argument string from a Fortran character value to a C string value and pass it to the C routine system(3C).

The routines sh and system(3F) differ in that system flushes the Fortran I/O buffers before calling the C routine system, while sh does not. Flushing the buffers can take significant time, and so, if any Fortran output is irrelevant to the result of the call, the routine sh is preferred over the routine system.

Note that both sh and system(3F) return integer results. Therefore, they must be declared to be of type INTEGER.

Files

libfsu.a

See Also

execve(2), wait(2), system(3C)

Bugs

string cannot be longer than 1024 characters.