It can be seen that +idx=1 and +echo1 are write(2,), which is the standard error output. Although it is displayed on the screen, > this content will not be written to the file by default. The following command can redirect standard error to 1
In the man bash manual chapter: CONDITIONAL EXPRESSIONS, -x means:
-x file
True if file exists and is executable.
The
parameter -x will list the order in which the shell executes statements and print them. +echo 1This kind of statement is not the output of the script, so it cannot be saved to a file.
Processing method:
Reason:
Trace it with strace
Result:
It can be seen that +idx=1 and +echo1 are write(2,), which is the standard error output. Although it is displayed on the screen, > this content will not be written to the file by default.
The following command can redirect standard error to 1
In the man bash manual chapter:
TheCONDITIONAL EXPRESSIONS
,-x
means:parameter
-x
will list the order in which the shell executes statements and print them.+echo 1
This kind of statement is not the output of the script, so it cannot be saved to a file.-xDebug mode