Search                        Top                                  Index
HELP GET_COMMAND_OUTPUT                            Aaron Sloman Oct 1997

get_command_output(arglist) -> string or false;
get_command_output(arglist, true) -> zero or more strings;

This procedure can be used to run a unix command and read the input into
pop-11, in the form of one or more strings.

There are two forms, one of which returns a string or false, while the
other returns a list of strings. The first can be used for a unix
command that returns one string as its result. The second can be used
for a unix command that produces multi-line output.

The list arglist should be a list of strings constituting a unix
command, such as can be given to * sysexecute. As explained in
    REF * SYSUTIL/'sysexecute('
arglist should  begin with  the  zero-th argument, i.e, that usually
used for the name of the program.

Examples follow:

;;; Run the command 'who' and read in only one line of output

get_command_output(['/bin/who' 'am' 'i'])=>

;;; Run the command 'who' and read in all lines of output
[%get_command_output(['/bin/who'], true)%]==>

;;; Run the hostname command

;;; Find a user's email name
get_command_output(['/bham/bin/mailname' 'axs'])=>

;;; Run a shell with ls as input:
[%get_command_output(['/bin/sh' '-c' 'ls -l /var/adm'], true)%]==>

;;; Run ls directly on a directory
[%get_command_output(['/bin/ls' '-l' '/var/adm'], true)%]==>

--- $poplocal/local/help/get_command_output
--- Copyright University of Birmingham 1997. All rights reserved. ------