Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: DEBUG_CMD_LINE (Was Re: PATCH: skip command from debug trap)
- X-seq: zsh-workers 25416
- From: Peter Stephenson <pws@xxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Subject: Re: DEBUG_CMD_LINE (Was Re: PATCH: skip command from debug trap)
- Date: Thu, 7 Aug 2008 11:14:38 +0100
- In-reply-to: <20080807093139.GA6839@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <6cd6de210808061419q2a81856cv62969490069e8f3e@xxxxxxxxxxxxxx> <20080807095441.3058605d@news01> <20080807093139.GA6839@xxxxxxxxxxxxxxx>
On Thu, 7 Aug 2008 10:31:40 +0100
Stephane Chazelas <Stephane_Chazelas@xxxxxxxx> wrote:
> On Thu, Aug 07, 2008 at 09:54:41AM +0100, Peter Stephenson wrote:
> [...]
> > It would be possible with a bit of fiddling to get the DEBUG trap to happen
> > at the level of elements of a sublist, i.e. commands separated by && and
> > ||, but I'm not sure if that's worth it. Beyond that you run into the
> > hideous complexity of pipelines and I don't think it can be pushed that far
> > down.
> [...]
>
> But see how PS4 is expanded for every command:
> $ zsh -o PROMPT_SUBST -c 'PS4="\$(od -vAn -N2 -x /dev/urandom) "
> set -x; : a | : b; : c && : d'
> 4542 : a
> e866 : b
> a7ad : c
> 6051 : d
Yes, there are printprompt4()'s scattered all over the code. However, PS4
doesn't interact with code execution as debug traps do.
> BTW, shouldn't PROMPT_SUBST be enabled by default in sh and ksh
> emulation?
If they do that, then presumably yes.
> Is there a way to run shell code (other than assignments and
> arithmetic expansion) upon the expansion of PS4? I thought of
> /(e:code:), but in scalar context I couldn't find a way for
> globbing to be performed.
I don't see how this differs from the stuff in $(...), which is treated as
a complete command line. Do you mean you need code to run within
the current shell?
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author