<< setenv OS_commands unix_s >>

Scilab Help >> Input/Output functions > OS_commands > unix_g

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

History

VersionDescription
2026.0.0

Tagged obsolete, use host instead.


Report an issue
<< setenv OS_commands unix_s >>