symbol | effect |
Command <file | The standard input file as a command |
Command << delimiter | Reads from the standard input, until it encounters a stop delimiter |
Command <Document 1> File 2 | The command file as a standard input and standard output to the file 2 |
Table: Input symbols and effect redirection
symbol | effect |
Command> file | The standard output is redirected to a file (clear the data in the original file) |
Command 2> file | The error output redirected to a file (clear the data in the original file) |
Command >> file | The standard output is redirected to a file (added after the original content) |
2 file command >> | The error output redirected to a file (be appended to the original content) |
Command >> file 2> & 1 or Commands & file >> |
The standard output and error common to write the file (added after the original content) |
Table II: effect of symbols and output redirection
'>' And '>>' Example:
Original file:
Use '>' to '123' write file:
result:
Reuse '>>' will 'test' writing:
'>' And '2>' Example:
xx file does not exist, '>' error message can not be written to the file, but the '2>' can
’