Comment 2 for bug 1179287

Revision history for this message
Thorsten Glaser (mirabilos) wrote :

POSIX:

   -x
          The shell shall write to standard error a trace for each command after it expands the command and
          before it executes it. It is unspecified whether the command that turns tracing off is traced.

GNU bash (master 2013-05-26 4.2 4.037):

manpage ⇒ -x
                    After expanding each simple command, for command, case
                    command, select command, or arithmetic for command,
                    display the expanded value of PS4, followed by the
                    command and its expanded arguments or associated word
                    list.

info ⇒ -x
               Print a trace of simple commands, for commands, case
               commands, select commands, and arithmetic for commands and
               their arguments or associated word lists after they are
               expanded and before they are executed. The value of the PS4
               variable is expanded and the resultant value is printed
               before the command and its expanded arguments.

   BASH_XTRACEFD
          If set to an integer corresponding to a valid file descriptor,
          Bash will write the trace output generated when `set -x' is
          enabled to that file descriptor. This allows tracing output to
          be separated from diagnostic and error messages. The file
          descriptor is closed when BASH_XTRACEFD is unset or assigned a
          new value. Unsetting BASH_XTRACEFD or assigning it the empty
          string causes the trace output to be sent to the standard error.
          Note that setting BASH_XTRACEFD to 2 (the standard error file
          descriptor) and then unsetting it will result in the standard
          error being closed.