[ Operating System | Reference Manual | Alphabetic Index ]
sh(+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 system/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
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]: sh('ls -F').
file1 dir1/
yes.
[eclipse]: sh(date).
Fri Aug 25 12:00:00 MET DST 1989
yes.
[eclipse]: sh("cd ..").
yes.
[eclipse]: sh('which eclipse').
/home/user/eclipse
yes.
Error:
sh(S). (Error 4).
sh(40). (Error 5).
See Also
exec / 2, exec / 3, exec_group / 3, setenv / 2, wait / 2