unix_g
executes some Windows, Linux or MacOS instructions: output in variables This function is obsolete. Please use host instead.
Syntax
[rep, status, msgerr] = unix_g(command)
Arguments
- command
A single text: instruction(s) to be executed
- rep
String: standard output.
- status
Integer, the OS command error status.
- msgerr
String: error message.
Description
unix_g(…)
executes a command on the Operating system using CMD on Windows or sh on Linux and macOS.
Scilab receives the standard output and possible error message yielded by the command execution.
It uses CMD on Windows and sh on Linux and MacOS
The starting working directory and environment variables of the opened interpreter are set as described for host().
The standard output is recorded in the variable rep
.
The standard error is recorded in the variable msgerr
.
When the unix_g
is called without msgerr
, the error is printed in the Scilab console.
Examples
function d=DIR(path) path = pathconvert(path,%t,%t) if getos() == 'Windows' then d = unix_g('dir '+path) else d = unix_g('ls '+path) end endfunction DIR('SCI/etc')
See also
- unix_s — executes some Windows, Linux or MacOS instructions: output canceled (Silent mode) This function is obsolete. Please use host instead.
- unix_w — executes some Windows, Linux or MacOS instructions: output in Scilab's console This function is obsolete. Please use host instead.
- unix_x — executes some Windows, Linux or MacOS instructions: output in a dedicated window This function is obsolete. Please use host instead.
- host — executes a Windows, Linux, or MacOS command
- getos — return Operating System name and version
- setenv — set the value of an environment variable
- powershell — executes a command with the Windows powershell interpreter (Windows only)
History
Version | Description |
2026.0.0 | Tagged obsolete, use host instead. |
Report an issue | ||
<< setenv | OS_commands | unix_s >> |