Mike Frysinger wrote:
> not sure if this is a bug or feature ... take this little snippet:
> testit() {
>       local foo=$(false) ; echo $?
>       foo=$(false) ; echo $?
> }
> 
> when we run the code, the output is:
> 0
> 1
> 
> rather than intuitive:
> 1
> 1

It's intentional.

`local' returns success if the variable is correctly assigned a value
(for instance, the variable is not read-only).  The assignment statement
returns failure because that's how POSIX says assignment statements
behave.  (export and readonly behave the same way as local.)

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    [EMAIL PROTECTED]    http://cnswww.cns.cwru.edu/~chet/


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to