Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.0 - 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.
However, this page did not exist in the previous stable version.

Scilab manual >> Input/Output functions > unix

unix

shell (sh) command execution

Calling Sequence

stat=unix(command-name)

Arguments

command-name

A character string containing Unix sh instruction

stat

An integer flag

Description

Sends a string command-name to Unix for execution by the sh shell. Standard output and standard errors of the shell command are written in the calling shell. stat gives -1 if unix can't be called (Not enough system memory available) or the sh return code.

Examples

if getos() <> 'Windows' then
  unix("ls $SCI/demos");
end

function wd=directory()
  if getos() == 'Windows' then
    unix('cd>'+TMPDIR+'\path');
  else
    unix('pwd>'+TMPDIR+'/path');
  end
  wd=read(TMPDIR+'/path',1,1,'(a)');
endfunction

wd=directory()
<< setenv Input/Output functions unix_g >>

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:
Wed Jan 26 16:23:43 CET 2011