<< unix_s OS_commands unix_x >>

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

unix_w

executes some Windows, Linux or MacOS instructions: output in Scilab's console

Syntax

unix_w(commands)

Arguments

commands

A single text: instruction(s) Windows, Linux or MacOS to be executed.

Description

unix_w(…) opens a new session of the Operating System (OS) command interpreter (sh with Linux, cmd.exe with Windows, etc..), sends commands to it, lets it processing commands instructions, receives the standard output and possible error message yielded by the processing, and closes the interpreter session.

The starting working directory and environment variables of the opened interpreter are set as described for host().

The standard output returned by the OS is displayed in Scilab's console ("_w" stands for the main Scilab's "Window").

If an instruction in commands generates an error,

The effects of valid instructions processed before the erroneous one remain actual (for instance, deleted files). However, their standard output is lost: It is not displayed in the Scilab console.
commands with multiple instructions are not recommended. They are more difficult to debug.

Examples

if getos() == 'Windows' then
  unix_w("dir "+'""'+WSCI+"\modules"+'""');
else
  unix_w("ls $SCI/modules");
end

See also


Report an issue
<< unix_s OS_commands unix_x >>