Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: Français - Português - Русский - 日本語
Scilab Help >> Input/Output functions > unix

unix

shell (sh) command execution

Syntax

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()

See Also

  • edit — function editing
  • manedit — editing a manual item
  • unix_g — shell (sh) command execution, output redirected to a variable
  • unix_s — shell (sh) command execution, no output
  • unix_w — shell (sh) command execution, output redirected to scilab window
  • unix_x — shell (sh) command execution, output redirected to a window
  • host — Unix or DOS command execution
Scilab Enterprises
Copyright (c) 2011-2015 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Jun 15 08:27:38 CEST 2016