[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Assigning to multiple variables on same line
From: |
Chet Ramey |
Subject: |
Re: Assigning to multiple variables on same line |
Date: |
Mon, 10 Aug 2009 15:25:23 -0400 |
User-agent: |
Thunderbird 2.0.0.22 (Macintosh/20090605) |
Yang Zhang wrote:
> Why does assigning to multiple variables on the same line exhibit
> sequential consistency normally but not for local variables?
Because `local' is a command, and word expansion is performed on its
arguments before it's invoked. This means the expansion is performed
before `local' performs the assignment (local sees two arguments:
`a=x' and `b='). Variable assignments by themselves behave differently --
expansion and assignment are done at the same time.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/