Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.1 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

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

unix_s

executes some Windows, Linux or MacOS instructions: output canceled (Silent mode)

Syntax

unix_s(commands)

Arguments

commands

Single text containing some Windows, Linux, or MacOS instructions.

Description

unix_s(…) 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 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 of processed instructions is ignored: Nothing is displayed neither in the Scilab console nor in the OS terminal (Windows consolebox).

If an instruction in commands generates an error,

  • the error message from the OS is displayed in the Scilab console,
  • unix_s stops and displays its own error message.
  • In commands, the remaining unprocessed instructions are ignored.
The effects of valid instructions processed before the erroneous one remain actual (for instance, deleted files). commands with multiple instructions are not recommended. They are more difficult to debug.

Examples

if getos() == 'Windows' then
  unix_s("del foo");
else
  unix_s("rm -f foo");
end

See also

  • unix_g — executes some Windows, Linux or MacOS instructions: output in variables
  • unix_w — executes some Windows, Linux or MacOS instructions: output in Scilab's console
  • unix_x — executes some Windows, Linux or MacOS instructions: output in a dedicated window
  • host — executes a Windows, Linux, or MacOS command
  • powershell — executes a command with the Windows powershell interpreter (Windows only)
  • setenv — set the value of an environment variable
  • getos — return Operating System name and version
Report an issue
<< unix_g OS_commands unix_w >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jan 03 14:23:28 CET 2022