First, the pipeline
The use of pipelines makes it easy to implement the output of one program as input to another program. Pipe symbol for ' | ', usage:
Commend | Commend | commend| ......
Example:
[Email protected]:~$ echo "ABCDEFG" | TR [: Lower:] [: Upper:]abcdefg[email protected]:~$ more/etc/passwd | grep ' Kdyzm ' kdyzm:x:1000:1000:kdyzm,,,:/home/kdyzm:/bin/bash[email protected]:~$
Second, redirect
Online Documentation: HTTP://PUBS.OPENGROUP.ORG/ONLINEPUBS/9699919799/UTILITIES/V3_CHAP02.HTML#TAG_18_07
1. Input and output description
English name Chinese name file descriptor stdin standard input 0STDOUT standard output 1STDERR standard error Output 2
2. Input redirection
< : input redirection (redirecting input) << : Document here (here-document)
(1). Enter redirection
[Email protected]:~$ tr [: Lower:] [: Upper:] </etc/passwd
(2). Documentation here
[Email protected]:~$ tr [: Lower:] [: Upper:] << eof> nihao> hello> world> eofnihaohelloworld[email prote cted]:~$
3. Output redirection
> : Overwrite output redirection >> : Append output redirect &>: Redirect error output and standard output to the same file 2> : Error output redirect (overwrite) 2>> : Error output redirect (append) |> : Overwrite output redirection is still allowed with SET-C set
Description
Overwrite output redirection is allowed by default, but there is a clear security issue, so you can use the switch to control
Set-c : When using output redirection, overwrite output redirection (>) set +C is not allowed if the file already exists : Turn off the function above
If you also want to use overwrite output redirection if SET-C is set, then use |>.
4. How do I save the output to a file while it is displayed on the screen?
Tee
Example:
Tee/tmp/temp.txt
This article is from the "stolen A Plum blog" blog, please be sure to keep this source http://kdyzm.blog.51cto.com/8316029/1740150
"Linxu learning 007" Pipeline and redirection