Contents | Index | < Browse | Browse >
PUSH
The PUSH instruction is used to prepare a stream of data to be read by a command shell or other program. It appends a newline to the result of the expression, then stacks or "pushes" it into the STDIN stream. Stacked lines are placed in the stream in "last-in, first-out" order and are available to be read just as though they had been entered interactively. For example, after issuing the instructions:

PUSH line 1
PUSH line 2
PUSH line 3

the stream would be read in the order line 3, line 2 and line 1.

PUSH allows the STDIN stream to be used as a private scratch pad to prepare data for subsequent processing. For example, several files could be concatenated with delimiters between them by simply reading the input files, PUSHing the line into the stream and inserting a delimiter where required. For example:

Do i=1 to 5
push 'echo "Line 'i'"'
end