system
This function executes system commands. It accepts an arbitrary number of function parameters where each of them contains one system command.
Calling this function with zero parameters have no effect.
Attention: In the 1980's, file names were limited to 6-8 capital letters and digits. Nowadays, many directory and file names contain spaces and special characters.
When using such path names in system commands, they need to be preconditioned in order to avoid confusing path and file names with spaces inbetween as multiple
command line parameters, as well as ensuring that the right directory separator symbols (slash or backslash) are used. Use the function quote path() to precondition
all path and file names where this function takes care of operating system specific differences.
Indirect parameter passing is enabled.
System commands are operating-system specific. Please refer to the (on-line) user guides and reference manuals of the operating system you are using
Min 0
No. | Type | Description |
---|---|---|
1, ... input |
string | System command This command will be executed. Add further commands into separate function parameters to have them executed one after the other. |
Type | Description |
---|---|
numeral | Return code The return code of the last command executed will be provided. Typically, 0 refers to successful outcome. -1 is returned if no system command has been executed. |
path[] = quote path("Examples/*table_lookup*.*");
echo("Path used for directory: ", path[]);
if (system info[operating system] = Windows)
{
a[] = system( "dir /w /b " + path[] );
}
else // Linux, MacOS
{
a[] = system( "ls " + path[] );
}
echo("Return value is ", a[] );
Path used for directory: Examples\*table_lookup*.*
LIB_Function_table_lookup.b4p
LIB_Function_table_lookup_fast.b4p
LIB_Function_table_lookup_once.b4p
LIB_Function_table_lookup_smart.b4p
LIB_Function_table_lookup_smart_once.b4p
LIB_Function_table_lookup_with_rules.b4p
LIB_Function_table_lookup_with_rules_once.b4p
Return value is 0