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
signature.asc
Description: OpenPGP digital signature