bug-bash
[Top][All Lists]
Advanced

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

Re: An xtrace variant


From: Eli Schwartz
Subject: Re: An xtrace variant
Date: Sun, 28 Jun 2020 15:51:37 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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