Shell

DESCRIPTION

Runs a program in a sub-shell, invoking the program or script from either /bin/sh or /bin/csh (on UNIX systems) or CMD.EXE (on Windows NT systems). Shell optionally redirects its input lattice to standard input of the invoked program, and similarly can redirect standard output of the program to an output lattice.

Shell works by concatenating its arguments (separated by spaces), writing them to a temporary command file, optionally copying the stdin byte input lattice to another temporary file, then running the shell using the command file. The standard output and standard error of the shell are optionally redirected to other temporary files. The latter is sent in a module alert to the UI, while the former is optionally piped to the output byte lattice port. The error code of the system() call that invoked the shell is returned as a parameter.

As an example, you can use Shell to list the files in the current directory. Type "ls" in the Command typein (under Windows NT, type "dir" instead). Shell runs the ls or dir command and sends the result to the output port. Click on "StdOut => UI" and the output of the ls command will appear in the usual manner of tty output from IRIS Explorer. Now click on "StdOut => Port" and wire the output port to PrintLat. Select character byte data and turn data printing on. You should again see the ls or dir output, but now presented by the UI as arriving from the PrintLat module.

INPUTS

Port: Std In
Type: Lattice
Optional: This port is optional.
Constraints: 1-vector
Constraints: byte
Optional Standard Input data

WIDGETS

Port: Command
Type: Text
Shell command or program to invoke.

Port: Shell Type
Type: Option Menu
Menu Item: Bourne
Menu Item: C
/bin/sh or /bin/csh

(N.B. under Windows NT, this widget is hidden - only the regular command interpreter CMD.EXE is available).

Port: First Arg
Type: Text
Additional shell arguments.

Port: Second Arg
Type: Text
Additional shell arguments.

Port: Third Arg
Type: Text
Additional shell arguments.

Port: Fourth Arg
Type: Text
Additional shell arguments.

Port: StdOut Dest
Type: Option Menu
Menu Item: Window
Menu Item: Port
Send standard out to byte output lattice or let the UI pick it up.

Port: StdIn Src
Type: Option Menu
Menu Item: TTY
Menu Item: Port
Take stdin from input port or from tty.

OUTPUTS

Port: Std Out
Type: Lattice
Constraints: 1-D
Constraints: 1-vector
Constraints: byte
Constraints: uniform
Optional Standard Output data.

Port: Return Status
Type: Parameter
What the shell returned.

KNOWN PROBLEMS

May leave some temporary files undeleted (in /usr/tmp under Unix).

SEE ALSO


[Documentation Home]
© The Numerical Algorithms Group Ltd, Oxford UK. 2000