Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.0 - Русский

Change language to:
English - 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 >> Input/Output functions > host

host

Unix or DOS command execution

Syntax

stat=host(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 command interpreter (sh under Unix, or command.com under DOS). Standard output and standard errors of the shell command are written in the calling shell. stat gives -1 if host can't be called (Not enough system memory available) or the command interpreter return code.

Examples

//create a getdir function based on host
function wd=getdir()
  if getos() == 'Windows' then
    host('cd>'+TMPDIR+'\path');
  else
    host('pwd>'+TMPDIR+'/path');
  end
  wd=read(TMPDIR+'/path',1,1,'(a)')
endfunction
//call it
wd=getdir()

See also

  • edit — функция редактирования
  • 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
Report an issue
<< getpid Input/Output functions input >>

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:
Tue Feb 14 15:13:25 CET 2017