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

Re: PATCH: improve ${(q)...}

Bart Schaefer wrote:
> On Apr 29,  9:51am, Peter Stephenson wrote:
> I'm not necessarily thinking of any specific example.  With the current
> code, ${(qqq)${(qq)v}} produces "'foo'" which still has single quotes
> after one level of quotes is stripped.  If that's combined with another
> string that also contains single quotes, whether by directly adjacent
> concatenation or by interpolation inside a double-quoted string, etc.,
> those quotes might mean something.

I still can't see how this can have an effect, but I think it's moot

> } I won't rely on my expectation here---it's different with backslash
> } quoting anyway.  However, you've certainly spotted a case I hadn't where
> } this changes the behaviour.  I can look for different letters...
> } Hmm, we could use qQ which is currently meaningless as a sort of
> } shorthand for "minimal quoting"...?
> What does (qqQQ) mean, then?  Or (qQq)?  It'd probably be better to pick
> something that currently isn't even valid syntax, like (q-) ... I was
> all set to suggest (q1) (q2) etc. but (q0) already means "split at NULL
> bytes and then quote".  However, (q-) raises the question of what (-q)
> means, and whether (-) by itself means anything; the only character that
> is currently "attached" to a preceding flag is ":" and (q:EXPR:) seems
> like overkill.

(q-) seems harmless and - on its own can be a syntax error as at
present.  I can't see any problem with that.  All this means as a
precedent is it would probably be better never to add - as a flag on its
own, which I can live with.

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