Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: DEBUG_CMD_LINE (Was Re: PATCH: skip command from debug trap)



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

BTW, shouldn't PROMPT_SUBST be enabled by default in sh and ksh
emulation?

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.

-- 
Stéphane



Messages sorted by: Reverse Date, Date, Thread, Author