A redirection pipe character and
1. Redirection (-tr): in the program, a data input and output:
-
- Data Input: keyboard - the standard input of people, but not the only way to input
- --stain
- echo "123456"|passwd --stdin"username"
- For example: function add user useradd.sh.user.txt text document 1000 users
. ./useradd SH II.A . / the useradd. SH .B ... . / the useradd. SH <user.txt> the while Line; do loop Line $ DONE </ etc / the passwd >
- Output data: Display - standard output, but not the only output
- fa file identifier 0-9 // equivalent to the document classification
- 0-- standard output
- 1-- standard input
- 2-- O error (standard error)
- Data Input: keyboard - the standard input of people, but not the only way to input
Common redirection symbols:
1. Standard Output
> Coverage redirection, use should pay attention to, extremely dangerous
ser -c // remove the redirect function
> | // Forced redirection
>> append redirection does not cover
2. The standard input
3. The error output
2> 2>>
Extension: outputting content need not, as long as the output state:
ls/etc/ > /dev/null if [$? -eq 0];then ,,,,, fi
&> &>> == 2&>1
ls/etc/ &> /dev/null
Second, the pipeline (TEE)
commdan1|commdan2|commdan3|.......
The results of the previous command to a command to execute:
[Linux idea: combine functions to achieve large small function] Example:
tee: one input, two-output
tee /tmp/tee.out // output screen once, then save again
first line
cat /tmp/tee.out
Example: