help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Introducing option to trace commands on and off


From: Khan Smith
Subject: Introducing option to trace commands on and off
Date: Wed, 13 Oct 2021 18:46:53 +0200

   Sent: Wednesday, October 13, 2021 at 4:42 PM
   From: "Dennis Williamson" <dennistwilliamson@gmail.com>
   To: "Khan Smith" <khansmith@mail.com>
   Cc: "help-bash" <help-bash@gnu.org>
   Subject: Re: Introducing option to trace commands on and off

   On Wed, Oct 13, 2021, 11:25 AM Khan Smith <[1]khansmith@mail.com>
   wrote:


   Sent: Wednesday, October 13, 2021 at 4:15 PM
   From: "Dennis Williamson" <[2]dennistwilliamson@gmail.com>
   To: "Khan Smith" <[3]khansmith@mail.com>
   Cc: "help-bash" <[4]help-bash@gnu.org>
   Subject: Re: Introducing option to trace commands on and off
   On Wed, Oct 13, 2021, 11:07 AM Khan Smith <[5]khansmith@mail.com>
   wrote:
   >
   > Have been spending some time debugging a script that is sourced from
   my
   > .bashrc
   >
   > I am using "set -x" to trace the commands but would l/ike to have an
   > option to turn the command tracing
   > on and off.
   >
   > Wauld like to find a neat way to do this.
   >
   set +x turns tracing off.

   I am sourcing a number of scripts. Would "set -x" apply to the current
   file or to
   everything?  Where is best to set the command?  In the topmost srcipt?




   The setting will apply to any commands after it's set. Sourced files
   are executed as if the lines appeared directly in the file sourcing
   them. Place set -x and set + around any lines you want traced. You can
   use those settings wherever and as many times as you want. Narrowing
   their range will allow you to focus on areas of interest and limit the
   amount of output where it's not needed.

   That's fantastic functionality, I appreciate that.

References

   1. mailto:khansmith@mail.com
   2. mailto:dennistwilliamson@gmail.com
   3. mailto:khansmith@mail.com
   4. mailto:help-bash@gnu.org
   5. mailto:khansmith@mail.com


reply via email to

[Prev in Thread] Current Thread [Next in Thread]