tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/47597: local and $() don't play well with each other



Hello,

On Tue, Feb 26, 2013 at 05:07:12PM +0700, Robert Elz wrote:
>[...] 
> 
> Why I never complained about this in the past, is that when I researched
> what was supposed to happen in the SUS, I saw this ...  (2.9.5)
> 
>       When a function is executed, it shall have the syntax-error and
>       variable-assignment properties described for special built-in
>       utilities in the enumerated list at the beginning of Special
>       Built-In Utilities.
> 
> And then (2.14)
> 
>       Variable assignments specified with special built-in utilities
>       remain in effect after the built-in completes; this shall not be
>       the case with a regular built-in or other utility.
> 
> That is, in the example above, according to the SUS, after the
>       foo=xxx f
> 
> the result of "echo $foo" (or just 'f' with no leading assignment)
> should be xxx, but with NetBSD it is bar.
> 

Are you using /bin/sh ?

$ cat /tmp/essai.sh
#!/bin/sh

f() { echo $foo; }
foo=bar
f
foo=XXX f

$ chmod 755 /tmp/essai
$ /tmp/essai.sh
bar
XXX

Did I misread your mail?
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                      http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index