SYSTEM

Execute an operating system command. If an array variable is passed as the second argument, the output from the command will be captured in that variable.

Syntax

SYSTEM(command, [arrayVariable])

Arguments

Argument Description Default
command The command to execute None
arrayVariable Array variable in which to store output. None

Results

Result Description
Return The last line, if any, of the command output
%%RC -1 if unable to start command
1 if 2nd argument is not an array variable
2 if 2nd argument is an array variable that is too small to contain the output

Examples

Function Call Return %%RC
SYSTEM("cd") current working directory 0
SYSTEM("echo %PBSSTTY%") [Windows]

SYSTEM("echo $PBSSTTY") [Unix/Linux]

Enrichment key in use 0

Hints

The contents of a file can be captured into an array variable. SYSTEM("type file.txt", %%myArray)