Apple Xserve Up Mac OS X Server Specifications Page 23

  • Download
  • Add to my manuals
  • Print
  • Page
    / 329
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 22
Chapter 1 Executing Commands 23
Standard Pipes
Many commands can receive text input from the user and print text to the console.
They do so using standard pipes, which are created by the shell and passed to the
command.
Standard pipes include:
 stdin—The standard input pipe is the means through which data enters a
command. By default, the user enters this from the command-line interface. You can
also redirect the output from files or other commands to stdin.
 stdout—The standard output pipe is where the command output is sent. By default,
command output is sent to the command line. You can also redirect the output from
the command line to other commands and tools.
Â
stderr—The standard error pipe is where error messages are sent. By default, errors
are displayed on the command line like standard output.
Redirecting Input and Output
From the command line, you can redirect input and output from a command to a file
or another command.
Redirecting output lets you capture the results of running the command and store it in
a file for later use. Similarly, providing an input file lets you provide a command with
preset input data, instead of needing to enter that data.
You can use the following characters to redirect input and output:
In addition to using file redirection, you can also redirect the output of one command
to the input of another using the vertical bar character, or pipe. You can combine
commands in this manner to implement more sophisticated versions of the same
commands.
For example, the command man bash | grep “commands” passes the formatted
contents of the bash man page to the grep tool, which searches those contents for
lines containing the word commands.” The result is a listing of lines with the specified
text, instead of the entire man page.
For more information about redirection, see the bash man page.
Redirect Description
> Use the greater-than character to redirect command output to a file.
< Use the less-than character to use the contents of a file as input to the command.
>> Use a double greater-than to append output from a command to a file.
Page view 22
1 2 ... 18 19 20 21 22 23 24 25 26 27 28 ... 328 329

Comments to this Manuals

No comments