Data Stream redirection
OUTPUT
> Output the correct data to the specified file or device in overwrite mode.
> Outputs the correct data to the specified file or device in an accumulative manner.
2> overwrite the error data to the specified file or device.
2> output error data to a specified file or device in the accumulative manner
Eg: ls-l> ~ /LsResu.txt
Ls-l/etc/123 2> ~ /LsResu.txt
Ls-l/etc/123> ~ /LsRightResu.txt 2> ~ /LsErrorResu.txt
What if I want to output correct and wrong data to the same file? Pai_^
Ls-l/etc/123> ~ /LsResu.txt 2> & 1
Ls-l/etc/123 &> ~ /LsResu.txt
What if I don't want to display the error message?
Ls-l/etc/123 2>/dev/null
INPUT
<The data is replaced by the file content (^ + D is required to end the input)
<End input with a string
Eg: cat> testDoc.txt <~ /. Bashrc
Cat> testDoc.txt <END
ELSE
What if you want to automatically execute the next command after executing a command?
Eg: ls-l; date
Judgment basis
& Execute from left to right, end when there is a mistake
| Execute from left to right. If there is a positive result, it ends (or ends naturally)
Eg: mkdir/etc/123 & ls-l/etc/123
Ls-l/etc/123 2>/dev/null | (mkdir/etc/123 & ls-l/etc/123) // If/etc/123 exists, the result is output. If not, the result is created and output. If an error occurs during creation, the result is not output.
Ps: After finishing the sorting, I really had a lot of GAINS.