![]() | ![]() | |||||||||||||||
|
Redirection and PipelinesThe input to a command, or the output from a command, can be redirected to files or, in some cases, other commands. Although there are subprograms in text_io package to perform some of these operations (e.g. set_output), the familliar Bourne shell syntax is also supported. Redirecting Standard Input, Output and Error
The redirection operands should appear after the command. => ls > list_output.txt 2> list_errors.txt These redirection operands also work with built-in shell commands like env or help. They will not work on subprograms like put_line. The redirect operands are considered to be a command line convenience. More powerful redirection is possible using the Text_IO package. Bourne shell: SparForte doesn't use file descriptor numbers so redirecting arbitrary open files using the Bourne shell syntax is not possible. Use the text_io package instead. PipelinesCommand pipelines are created by connecting one or more commands using the pipe (|) symbol. => ls | grep ".txt" The result from a command pipeline is the result of the last command
in the pipeline. Pipelines can only have one input redirection
(for
the first command), one output redirection and one error redirection
(for
the final command). Pipelines cannot be run in the background
using
&.
|
![]() Block Statements and Subprograms |
![]() |
![]() |