Fix redundancy. While here, correct usage of unix and tighten wording.
Sponsored by: Essen Devsummit Hackathon
This commit is contained in:
parent
9d8db2d90d
commit
a91359e94e
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=47085
1 changed files with 20 additions and 22 deletions
|
|
@ -3178,14 +3178,14 @@ Swap: 2048M Total, 2048M Free
|
||||||
<para>Shell redirection is the action of sending the output or
|
<para>Shell redirection is the action of sending the output or
|
||||||
the input of a command into another command or into a file.
|
the input of a command into another command or into a file.
|
||||||
To capture the output of the &man.ls.1; command, for example,
|
To capture the output of the &man.ls.1; command, for example,
|
||||||
into a file, simply redirect the output:</para>
|
into a file, redirect the output:</para>
|
||||||
|
|
||||||
<screen>&prompt.user; <userinput>ls > directory_listing.txt</userinput></screen>
|
<screen>&prompt.user; <userinput>ls > directory_listing.txt</userinput></screen>
|
||||||
|
|
||||||
<para>The <filename>directory_listing.txt</filename> file will
|
<para>The directory contents will now be listed in
|
||||||
now contain the directory contents. Some commands allow you
|
<filename>directory_listing.txt</filename>. Some commands can
|
||||||
to read input in a similar one, such as &man.sort.1;. To sort
|
be used to read input, such as &man.sort.1;. To sort this
|
||||||
this listing, redirect the input:</para>
|
listing, redirect the input:</para>
|
||||||
|
|
||||||
<screen>&prompt.user; <userinput>sort < directory_listing.txt</userinput></screen>
|
<screen>&prompt.user; <userinput>sort < directory_listing.txt</userinput></screen>
|
||||||
|
|
||||||
|
|
@ -3196,26 +3196,24 @@ Swap: 2048M Total, 2048M Free
|
||||||
<screen>&prompt.user; <userinput>sort < directory_listing.txt > sorted.txt</userinput></screen>
|
<screen>&prompt.user; <userinput>sort < directory_listing.txt > sorted.txt</userinput></screen>
|
||||||
|
|
||||||
<para>In all of the previous examples, the commands are
|
<para>In all of the previous examples, the commands are
|
||||||
performing redirection using file descriptors. Every unix
|
performing redirection using file descriptors. Every &unix;
|
||||||
system has file descriptors; however, here we will focus on
|
system has file descriptors, which include standard input
|
||||||
three, so named as Standard Input, Standard Output, and
|
(stdin), standard output (stdout), and standard error
|
||||||
Standard Error. Each one has a purpose, where input could be
|
(stderr). Each one has a purpose, where input could be a
|
||||||
a keyboard or a mouse, something that provides input. Output
|
keyboard or a mouse, something that provides input. Output
|
||||||
could be a screen or paper in a printer for example. And
|
could be a screen or paper in a printer. And error would be
|
||||||
error would be anything that is used for diagnostic or error
|
anything that is used for diagnostic or error messages. All
|
||||||
messages. All three are considered <acronym>I/O</acronym>
|
three are considered <acronym>I/O</acronym> based file
|
||||||
based file descriptors and sometimes considered
|
descriptors and sometimes considered streams.</para>
|
||||||
streams.</para>
|
|
||||||
|
|
||||||
<para>Through the use of these descriptors, short named stdin,
|
<para>Through the use of these descriptors, the shell allows
|
||||||
stdout, and stderr, the shell allows output and input to be
|
output and input to be passed around through various commands
|
||||||
passed around through various commands and redirected to or
|
and redirected to or from a file. Another method of
|
||||||
from a file. Another method of redirection is the pipe
|
redirection is the pipe operator.</para>
|
||||||
operator.</para>
|
|
||||||
|
|
||||||
<para>The &unix; pipe operator, <quote>|</quote> allows the
|
<para>The &unix; pipe operator, <quote>|</quote> allows the
|
||||||
output of one command to be directly passed, or directed to
|
output of one command to be directly passed or directed to
|
||||||
another program. Basically a pipe will allow the standard
|
another program. Basically, a pipe allows the standard
|
||||||
output of a command to be passed as standard input to another
|
output of a command to be passed as standard input to another
|
||||||
command, for example:</para>
|
command, for example:</para>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue