[ Operating System | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

# system(+ShellCommand)

The string or atom ShellCommand is passed as a command to the operating system, and the command is executed there (it is a synonym for sh/1).

ShellCommand
  String or atom.

## Description

Used to send a command ShellCommand to the operating system. The command uses the streams input, output and error as the UNIX streams stdin, stdout and stderr respectively. ECLiPSe -specific streams, like null or a string stream, can not be used.

### Modes and Determinism

- system(+) is semidet

### Fail Conditions

Fails if the Shell couldn't be executed or if the command returned a non-zero status

### Exceptions

(4) instantiation fault
  ShellCommand is not instantiated.
(5) type error
  ShellCommand is instantiated, but not to a string or atom.

## Examples

    Success:
          [eclipse]: system('ls -F').
          file1       dir1/
          yes.

          [eclipse]: system(date).
          Fri Aug  25 12:00:00 MET DST 1989
          yes.

          [eclipse]: system("cd ..").
          yes.

          [eclipse]: system('which eclipse').
          /home/user/eclipse
          yes.

    Error:
          system(S).                     (Error 4).
          system(40).                    (Error 5).

## See Also

exec / 2, exec / 3, exec_group / 3, setenv / 2, sh / 1, wait / 2