Function Reference
— Built-in Function: system (string, return_output, type)

Execute a shell command specified by string. The second argument is optional. If type is "async", the process is started in the background and the process id of the child process is returned immediately. Otherwise, the process is started, and Octave waits until it exits. If type argument is omitted, a value of "sync" is assumed.

If two input arguments are given (the actual value of return_output is irrelevant) and the subprocess is started synchronously, or if system is called with one input argument and one or more output arguments, the output from the command is returned. Otherwise, if the subprocess is executed synchronously, its output is sent to the standard output. To send the output of a command executed with system through the pager, use a command like

          disp (system (cmd, 1));

or

          printf ("%s
          ", system (cmd, 1));

The system function can return two values. The first is the exit status of the command and the second is any output from the command that was written to the standard output stream. For example,

          [status, output] = system ("echo foo; exit 2");

will set the variable output to the string ‘foo’, and the variable status to the integer ‘2’.