up previous next
SystemCommand    --    run a system command


Syntax
SystemCommand(CMD: STRING): INT

Description
This function will work only if the CoCoA interpreter was started with the "enable system command" flag set; by default the flag is not set since system commands can be used maliciously (e.g. to delete files).

This function expects a string containing a "system command" (e.g. a shell command on Linux platforms). The string CMD is passed to the underlying operating system command line interpreter for execution. The return value of SystemCommand depends on the platform (i.e. the C++ run-time environment), so should not be relied upon to provide any specific information: e.g. on some Linux systems the value returned is the exit code, on others it is 256 times the process exit code.

Example
/**/ ExitCode := SystemCommand("echo abc");  --> value of ExitCode is unclear
abc