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

Re: PATCH: Re: Shell-word splitting (was: Re: Proposed _history completer)



> Anyway, here's the patch, implementing the (z) flag which makes the
> parameter value be zplitted uzing zsh zhell zyntax. This works a bit
> like the (s) flag (or the `=' before the name) and is done at the very
> end, so to access words resulting from the splitting:
> 
>   % foo='it says: "hello world"'
>   % echo ${${(z)foo}[3]}
>   "hello world"
> 
> We could probably move the code that does the splitting up somewhere
> but it would then behave more differently from (s) and = than it does
> now, so that would probably be a bad idea.

This is probably right, but it could do with mentioning explicitly,
including in the rules for parameter substitution, otherwise it's a little
non-obvious that you can't do e.g. ${(Qz)foo} to get rid of the quotes.
You can do ${(Q)${(z)foo}}, so it's no problem as long as you know about
it.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxxx>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



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