A bit 'of examples of redirection in BASH.
Standard input = 0.
Standard output = 1 (all that is printed with printf in C, and court in C + +).
Standard error = 2 (all that is printed with perror in C, and cerr in C + +).
Redirect the output of a program in a file (if it exists, the contents are overwritten).
cmd> filename
cmd 1> filename Redirect
the error of a program in a file (if it exists, the contents are overwritten).
cmd 2> filename
Redirect the output of a program in a file (if it exists, the new text is added in append mode, at the end of the file).
cmd>> filename
cmd 1>> filename
Redirect the error of a program in a file (if it exists, the new text is added in append mode, at the end of the file).
cmd 2>> filename
Redirect the output is that the error a program in a file.
cmd &> filename
Redirect the output of a program in error.
cmd> & 2
cmd 1> & 2 Redirect
the error in a program's output.
cmd 2> & 1
0 comments:
Post a Comment