Output redirection of the Linuxshell script, which supports input and output redirection in the Linux Shell environment, is represented by symbols < and >. 0, 1, and 2 represent standard input, standard output, and standard error information output, which can be used to specify standard inputs or outputs that require redirection, such as 2>a.txt to output error messages to file A.txt.
Input-output redirection is supported in the Linux Shell environment, represented by symbols < and >. 0, 1, and 2 represent standard input, standard output, and standard error information output, which can be used to specify standard inputs or outputs that require redirection, such as 2>a.txt to output error messages to file A.txt.
In the meantime, redirects can be achieved between these three standard input outputs, such as redirecting error messages to standard output, and can be implemented using 2>&1.
Linux also has a special file/dev/null, it is like a bottomless pit, all redirected to its information will disappear without a trace. This is useful when we can redirect output to/dev/null when we do not need to echo all the information about the program.
If you want normal output and error messages to be displayed, redirect both standard output and standard error to/dev/null, for example:
# ls 1>/dev/null 2>/dev/null
Another approach is to redirect errors to standard output, and then redirect to/dev/null, for example:
# ls >/dev/null 2>&1
Note: The order here cannot be changed, otherwise the desired effect is not achieved, the standard output is redirected to/dev/null first, then the standard error is redirected to standard output, and the standard error is redirected to/dev/null because the standard output has been redirected to/dev/null. So it's all quiet:-)
In addition +:
$make >& Filename.log &
It means redirecting both standard and error outputs, make>out only the standard output is redirected
>log means redirecting standard output to file log
>& log indicates that both standard output and error output are directed to the file log, equivalent to >log 2>&1