make 2> & 1 | tee log.txt command parsing

 make 2> & 1 | tee log.txt command parsing


What 1. make that?

make linux is a very powerful command, the simple point is that you want to compile your source code to rely on him.

2.2> & 1 What does this mean?

Stdin 0, 1 stdout, stderr 2

2> & 1 should be divided into two portions view, a 2> & 1 and the other is,

where 2> is the standard error is redirected to a particular place; 1 & whether standard means where output.
 

So mean 2> & 1 Mistakes that is, whether the standard, the standard error will be redirected to the standard output.

 

Sometimes you want to redirect the wrong message to the output it is to redirect the results of 2 to 1 there will be a "2> 1" this line of thought, according to the above wording, the system will default error message (STDERR) 2 redirected to a file named 1, and not think (STDOUT) in. Therefore we need to add & to distinguish. There is such usage 2> & 1



3. | pipeline

effect is to provide a pipe passage, on a standard output redirection program to the next program as the standard input of the next program.

Benefits commonly used form of simple pipe on the one hand, on the other hand it is much higher than the efficiency of the use of temporary files.

The purpose here is to use the pipe to make the output of the program is redirected to the next program, the ultimate purpose is to log into the output file.

4. tee is used to do?

tee reads from the standard input, and writes the read content, and the standard output file.
 

So here the role of the tee command reads the data and writes to the standard output, and, log.txt.

 

 

 


The reason you want to save the log generated by the compiler to log.txt, which is due to cache your standard output may be limited, and you log produced by the compiler may be many, this is likely to result in incomplete log;

the aim is to compile a program when the error occurred, we can see the complete compilation log from log.txt, so easy to find compilation errors.

Released five original articles · won praise 4 · Views 2790

 make 2> & 1 | tee log.txt command parsing

Guess you like

Origin blog.csdn.net/jian3214/article/details/93721148
tee