Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Accessing the evaluated expression which caused an error
- X-seq: zsh-users 27084
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zach Riggle <zachriggle@xxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Accessing the evaluated expression which caused an error
- Date: Sat, 4 Sep 2021 13:08:01 -0700
- Archived-at: <https://zsh.org/users/27084>
- In-reply-to: <CAMP9c5ncfwHjWMaFuf=u6WhvNiN_UqMMArxtmHt4A+HqFMN0NA@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAMP9c5mLwUce-23zmZAbCtHU+q-BzLbYTV482YcohXoj__ynZw@mail.gmail.com> <CAH+w=7aT6rgWDnfr0A=j7nrv2PjQMDJddefRhTg_VrmU2YF_6w@mail.gmail.com> <CAMP9c5ncfwHjWMaFuf=u6WhvNiN_UqMMArxtmHt4A+HqFMN0NA@mail.gmail.com>
On Fri, Sep 3, 2021 at 10:38 AM Zach Riggle <zachriggle@xxxxxxxxx> wrote:
>
> > What exactly might you want captured?
>
> Very frequently I build a create an array that contains a command [...]
> And invoke it like:
>
> "${cmd[@]}"
Given that you're doing it that way (rather than say "eval" it), you
should be able to use TRAPDEBUG and just do this:
TRAPDEBUG() { ACTUAL_CMD=${(e)ZSH_DEBUG_CMD} }
You may want some other "protection" around that, such as only doing
it when ZSH_DEBUG_CMD matches a pattern.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author