Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Re: Shell-word splitting (was: Re: Proposed _history completer)
- X-seq: zsh-workers 11116
 
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxxx>
 
- To: zsh-workers@xxxxxxxxxxxxxx (Zsh hackers list)
 
- Subject: Re: PATCH: Re: Shell-word splitting (was: Re: Proposed _history completer)
 
- Date: Wed, 03 May 2000 13:54:37 +0100
 
- In-reply-to: "Your message of Wed, 03 May 2000 14:20:33 +0200." <200005031220.OAA00376@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
 
> 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