Redirection 11, correct content redirection symbol & gt; output redirection to a file or device overwrite the original file & gt ;! The output is redirected to a file or device to forcibly overwrite the original file & gt;
Redirection
1.1. the redirection symbol of the correct content
> The output is redirected to a file or device to overwrite the original file.
>! The output is redirected to a file or device to forcibly overwrite the original file.
> The output is redirected to a file or device to append the original file.
<Redirect input to a program
1.2, standard error redirection symbol
2> redirect a standard error output to a file or device to overwrite the original file B-shell
2> redirect a standard error output to a file or device and append it to the original file.
2> & 1 redirect a standard error output to the standard output. note: 1 may represent the standard output.
> & Redirect a standard error output to a file or device to overwrite the original file c-shell
| & Deliver a standard error pipeline to another command as input
1.3, &> correct and wrong redirection symbols
Resolution: upload the information in the pythfile to the temp.txt file in the user's current directory.
However, this file does not exist. Therefore, the information entered in the temp.txt file is No such file or directory.
Resolution: upload the information in the pythonfile to the temp.txt file in the user's current directory. There is a python directory under the current user directory,
Therefore, the information entered in the temp.txt file is the information of the files contained in this directory.
Note:> The redirection will clear the input file.
MPs queue
Pipeline symbol |
Purpose: based on the previous command, submit it to the next command for further processing (the output of the previous command is used as the input of the subsequent command)
Resolution:
The ll command is short for ls-l (view file attributes and other details );
The grep command is a regular expression;
The wc command is used to count the number of lines, words, and bytes in a specified file;
Tee command to read standard input data and output the content into a file;
Compile the file information in the pythondirectory. use the regular expression to write the information to the temp.txt file, and then count the number of lines, words, and bytes of the file.