zsh-users
 help / color / mirror / code / Atom feed
* Set -x for scripts globally / recursively
@ 2021-07-30 17:39 Zach Riggle
  2021-07-30 22:06 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Zach Riggle @ 2021-07-30 17:39 UTC (permalink / raw)
  To: Zsh Users

Hello all!

Is there any way to cause the "-x" / xtrace flag to be passed into
sub-scripts without doing so explicitly?  I expect there's an
environment variable that might be able to do this, but I'm not sure.

My issue is that I want to trace e.g. ./foo which invokes ./bar which
then invokes ./baz, where all three are Zsh scripts -- and I want them
all to be traced.

I spent some time in the docs (searching for "environment" in the PDF
copy) but I didn't find anything, unfortunately.

Thanks for your help!
Zach Riggle


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Set -x for scripts globally / recursively
  2021-07-30 17:39 Set -x for scripts globally / recursively Zach Riggle
@ 2021-07-30 22:06 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2021-07-30 22:06 UTC (permalink / raw)
  To: Zach Riggle; +Cc: Zsh Users

On Fri, Jul 30, 2021 at 10:39 AM Zach Riggle <zachriggle@gmail.com> wrote:
>
> Is there any way to cause the "-x" / xtrace flag to be passed into
> sub-scripts without doing so explicitly?

The only way to do this infallibly is to put "setopt xtrace" in /etc/zshenv.

If the scripts are NOT run with the -f flag, you can place that
command in a file named ".zshenv" in a temporary directory, and export
ZDOTDIR to point at that temporary directory.

The only other option is to edit the #! line of each script and change
-f to -fx.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-30 22:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 17:39 Set -x for scripts globally / recursively Zach Riggle
2021-07-30 22:06 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).