<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>unix_g</TITLE>
  <TYPE>Scilab Function</TYPE>
  <DATE>April 1993</DATE>
  <SHORT_DESCRIPTION name="unix_g"> shell (sh) command execution, output redirected to a variable</SHORT_DESCRIPTION>
  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>rep=unix_g(cmd)  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>[rep,stat]=unix_g(cmd)  </CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>
  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>cmd</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: a character string</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>rep</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: a column vector of character strings</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>stat</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: a integer, the error status. stat=0 if no error occured</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>
  <DESCRIPTION>
    <P>
    Sends a string <VERB>cmd</VERB> to Unix for execution by the sh
    shell. The standard output is redirected to scilab variable <VERB>rep</VERB>.
    Unix execution errors are trapped; *NOTE* that only the last shell command
    error is reported when a list of command separated by &quot;;&quot; is sent: this is
    not recommended.</P>
  </DESCRIPTION>
  <EXAMPLE>
<![CDATA[
function d=DIR(path)
  path=pathconvert(path,%t,%t)
  if MSDOS then
    d=unix_g('dir '+path)
  else
    d=unix_g('ls '+path)
  end
endfunction

DIR('SCI/demos')
 ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>unix_s</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>unix_w</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>unix_x</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>unix</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
</MAN>
