help-bash
[Top][All Lists]
Advanced

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

Re: Introducing option to trace commands on and off


From: Dennis Williamson
Subject: Re: Introducing option to trace commands on and off
Date: Wed, 13 Oct 2021 11:42:35 -0500

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

>
> *Sent:* Wednesday, October 13, 2021 at 4:15 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:07 AM Khan Smith <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.

>


reply via email to

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