20. Bash Shell - IO Redirection
Contents
With the IO redirection feature, we can easily manipulate the input and output of files or other information.
Standard Output
The standard output stream is usually used to print the output of a program to a file, its file descriptor is 1.
Output Text to a File
|
|
Output Result to a File
|
|
Append Text to a File
|
|
Append Result to a File
|
|
Standard Input
Standard input streams are usually used to print the contents of a file to a screen, its file descriptor is 0.
Read Text from a File
|
|
Copy Text from a File to Another File
|
|
Multi-line Text to a File Using Here Documents
|
|
Standard Error
Standard error streams are typically used to print error content from the output of a program to a file, its file descriptor is 2.
Redirects Error Messages to a File
|
|
Suppress the Error Messages
|
|
Show Error Messages and Output Standard Results to a File
|
|
|
|
References 3.6 Redirections
Author Dong Chen
LastMod Thu Feb 21 2019