zsh-users
 help / color / mirror / code / Atom feed
* splitting in assignment forms of expansion
@ 2012-09-27  2:42 Han Pingtian
  2012-09-27  4:41 ` Mikael Magnusson
  0 siblings, 1 reply; 4+ messages in thread
From: Han Pingtian @ 2012-09-27  2:42 UTC (permalink / raw)
  To: zsh-users

Hello,

The manpage of zshexpn states about "${=...}":

      Note  that  splitting is applied to word in the assignment forms
      of spec before  the  assignment  to  name  is  performed.   This
      affects the result of array assignments with the A flag.

but looks like the splitting isn't applied to word first:

% print -l ${=xx::=foo           bar}
foo
bar
%  print -l $xx
foo           bar
%

I'm confused on this. Please help.

Thanks.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: splitting in assignment forms of expansion
  2012-09-27  2:42 splitting in assignment forms of expansion Han Pingtian
@ 2012-09-27  4:41 ` Mikael Magnusson
  2012-09-29  1:40   ` Han Pingtian
  2012-12-27  7:08   ` Han Pingtian
  0 siblings, 2 replies; 4+ messages in thread
From: Mikael Magnusson @ 2012-09-27  4:41 UTC (permalink / raw)
  To: Han Pingtian; +Cc: zsh-users

On 27/09/2012, Han Pingtian <hanpt@linux.vnet.ibm.com> wrote:
> Hello,
>
> The manpage of zshexpn states about "${=...}":
>
>       Note  that  splitting is applied to word in the assignment forms
>       of spec before  the  assignment  to  name  is  performed.   This
>       affects the result of array assignments with the A flag.
>
> but looks like the splitting isn't applied to word first:
>
> % print -l ${=xx::=foo           bar}
> foo
> bar
> %  print -l $xx
> foo           bar
> %
>
> I'm confused on this. Please help.

If you actually use the (A) flag,
% print -l ${=xx::=foo bar} . $xx . ${(A)=xx::=foo bar} . $xx
foo
bar
.
foo bar
.
foo
bar
.
foo
bar

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: splitting in assignment forms of expansion
  2012-09-27  4:41 ` Mikael Magnusson
@ 2012-09-29  1:40   ` Han Pingtian
  2012-12-27  7:08   ` Han Pingtian
  1 sibling, 0 replies; 4+ messages in thread
From: Han Pingtian @ 2012-09-29  1:40 UTC (permalink / raw)
  To: zsh-users

On Thu, Sep 27, 2012 at 06:41:25AM +0200, Mikael Magnusson wrote:
> On 27/09/2012, Han Pingtian <hanpt@linux.vnet.ibm.com> wrote:
> > Hello,
> >
> > The manpage of zshexpn states about "${=...}":
> >
> >       Note  that  splitting is applied to word in the assignment forms
> >       of spec before  the  assignment  to  name  is  performed.   This
> >       affects the result of array assignments with the A flag.
> >
> > but looks like the splitting isn't applied to word first:
> >
> > % print -l ${=xx::=foo           bar}
> > foo
> > bar
> > %  print -l $xx
> > foo           bar
> > %
> >
> > I'm confused on this. Please help.
> 
> If you actually use the (A) flag,
> % print -l ${=xx::=foo bar} . $xx . ${(A)=xx::=foo bar} . $xx
> foo
> bar
> .
> foo bar
> .
> foo
> bar
> .
> foo
> bar
OK thanks. I'll remember this only works with (A) flag.
> 
> -- 
> Mikael Magnusson


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: splitting in assignment forms of expansion
  2012-09-27  4:41 ` Mikael Magnusson
  2012-09-29  1:40   ` Han Pingtian
@ 2012-12-27  7:08   ` Han Pingtian
  1 sibling, 0 replies; 4+ messages in thread
From: Han Pingtian @ 2012-12-27  7:08 UTC (permalink / raw)
  To: zsh-users

On Thu, Sep 27, 2012 at 06:41:25AM +0200, Mikael Magnusson wrote:
> On 27/09/2012, Han Pingtian <hanpt@linux.vnet.ibm.com> wrote:
> > Hello,
> >
> > The manpage of zshexpn states about "${=...}":
> >
> >       Note  that  splitting is applied to word in the assignment forms
> >       of spec before  the  assignment  to  name  is  performed.   This
> >       affects the result of array assignments with the A flag.
> >
> > but looks like the splitting isn't applied to word first:
> >
> > % print -l ${=xx::=foo           bar}
> > foo
> > bar
> > %  print -l $xx
> > foo           bar
> > %
> >
> > I'm confused on this. Please help.
> 
> If you actually use the (A) flag,
> % print -l ${=xx::=foo bar} . $xx . ${(A)=xx::=foo bar} . $xx
> foo
> bar
> .
> foo bar
> .
> foo
> bar
> .
> foo
> bar
> 
I think we should say something like this about this feature in the man
page:

    Note during assignments with the A flag, that  splitting is applied to word 
    in the assignment forms of spec before  the  assignment  to  name  is  performed.
    This will affects the result.

This sounds more clearly. Right?
    


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-27  7:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-27  2:42 splitting in assignment forms of expansion Han Pingtian
2012-09-27  4:41 ` Mikael Magnusson
2012-09-29  1:40   ` Han Pingtian
2012-12-27  7:08   ` Han Pingtian

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).