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

Re: print -D and ${(D)} quoting

On Oct 12,  9:53pm, Peter Stephenson wrote:
} Here, I think, is the uncontroversial part, that changes the (D)
} substitution flag.

Naturally, asserting lack of controversy means I have a question ...

} Index: Doc/Zsh/expn.yo
} ===================================================================
}  item(tt(D))(
}  Assume the string or array elements contain directories and attempt
} +to substitute the leading part of these by names.  The remainder of
} +the path (the whole of it if the leading part was not subsituted)
} +is then quoted so that the whole string can be used as a shell
} +argument.  This is the reverse of `tt(~)' substitution:  see
}  ifnzman(noderef(Filename Expansion))\
}  ifzman(the section FILENAME EXPANSION below).
}  )

Is quoting the rest of the string really the correct thing to do?
Consider ${${(D)foo}:r} or ${=${(D)foo}}.  Why do you believe 
${(Q)$(D)foo}} should be necessary to operate on the original
string, modulo tilde contraction?  Is it because that's easier
on a zsh script programmer than figuring out where to use (q)?
Perhaps steps 13 and 14 from the "rules" should be combined in
some way, so (qD) together differs from either used alone?  


The implementation of the (q-) flag is still a bit confusing; the
form (q-q) behaves like (qq), but (qq-) is "error in flags" whereas
(q-qq), (q-qqq), etc. for any number of "q" after the "-", reports:
    Src/utils.c:4685: BUG: bad quote type in quotestring
and then behaves like (qq).

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