Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16473

Re: An xtrace variant

From Eli Schwartz <eschwartz@archlinux.org>
Newsgroups gnu.bash.bug
Subject Re: An xtrace variant
Date 2020-06-28 15:51 -0400
Message-ID <mailman.588.1593373916.2574.bug-bash@gnu.org> (permalink)
References <87h7uv0zi8.fsf@hobgoblin.ariadne.com> <be988bdb-ab91-877b-e85d-366f6fd8563e@archlinux.org>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On 6/28/20 3:19 PM, Dale R. Worley wrote:
> When debugging a shell script, a useful command is:
> 
>     bash -x script-name
> 
> The deficiency of this is that "-x" causes all simple commands in your
> startup files to be echoed as they are executed, and often this output
> is a lot longer than the output from the commands in the script.
> 
> For a long time, I've wanted a variant of -x that only echoed the simple
> commands after bash is done executing the startup files.  I finally did
> a test implementation, naming a new switch "-X".  If it is set at the
> end of the execution of the startup files, then bash sets "-x", which
> causes subsequent simple commands to be echoed.
Why not just run bash -x script-name without the bash -l option and
without $BASH_ENV set?

The first is implicitly true based on your stated command line. The
second doesn't seem like a high bar to set, and it's not exactly default
behavior... if you really do need $BASH_ENV can't you do the set -x at
the end of that file?

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: An xtrace variant Eli Schwartz <eschwartz@archlinux.org> - 2020-06-28 15:51 -0400

csiph-web