*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> system (3)              
Title
Content
Arch
Section
 

system(3)

Contents


NAME    [Toc]    [Back]

       system - Execute a shell command

SYNOPSIS    [Toc]    [Back]

       #include <stdlib.h>

       int system(
               const char *string );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

STANDARDS    [Toc]    [Back]

       Interfaces  documented  on  this reference page conform to
       industry standards as follows:

       system():  XPG4, XPG4-UNIX

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

PARAMETERS    [Toc]    [Back]

       Specifies a valid sh shell command.

              If  string is NULL (0), the system() function tests
              the accessibility of the sh command interpreter.

              If string is not NULL, the system() function passes
              the  parameter  to the sh command, which interprets
              string as a command and executes it.

DESCRIPTION    [Toc]    [Back]

       The system() function passes the string parameter  to  the
       sh  command, which interprets string as a command and executes
 it. See sh(1) to determine which command interpreter
       is defined by sh on your system.

       The  system() function invokes the fork() function to create
 a child process that in turn uses theexec function  to
       run  sh,  which  interprets the shell command contained in
       the string parameter. The current process waits until  the
       shell has completed before returning.

RETURN VALUES    [Toc]    [Back]

       If  the  string  parameter  is NULL, the system() function
       returns 0 if it is unable to  access  the  command  interpreter
 or a non-zero value if sh is accessible.

       If  the string parameter is not NULL, upon successful completion
 by sh, the system() function returns the exit status
 of the shell process in the form that wait(2) returns.
       Otherwise, the system() function returns a value of -1 and
       sets errno to indicate the error.

       Exit status 127 indicates that the shell could not be executed.


       Note that the exit status should only be interpreted using
       the   macros   described   in   wait(2)   and  defined  in
       thesys/wait.h header file.


ERRORS    [Toc]    [Back]

       The system() function sets errno to the  specified  values
       for the following conditions: The status of the child process
 created by system() is no longer available.

       In addition, the system() function may set errno values as
       described by fork().

SEE ALSO    [Toc]    [Back]

      
      
       Functions: exec(2), exit(2), fork(2), wait(2)

       Commands: sh(1)

       Standards: standards(5)



                                                        system(3)
[ Back ]
 Similar pages
Name OS Title
suattr IRIX Execute shell command with specified capabilities at specified MAC label
sh Tru64 Shell, the standard command language interpreter (POSIX Shell)
Rsh Tru64 The Bourne shell, an interactive command interpreter and command programming language
sh Tru64 The Bourne shell, an interactive command interpreter and command programming language
VkForkIO IRIX Command-line interface to shell command component
remsh HP-UX execute from a remote shell
rexec HP-UX execute from a remote shell
array IRIX execute an array command
pagsh OpenBSD execute a command without authentication
command IRIX execute a simple command
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service