NetBSD-Bugs 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



The following reply was made to PR bin/47597; it has been noted by GNATS.

From: David Laight <david%l8s.co.uk@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/47597: local and $() don't play well with each other
Date: Tue, 26 Feb 2013 08:38:00 +0000

 On Tue, Feb 26, 2013 at 02:45:01AM +0000, 
julio+host-netbsd-jmmv%meroh.net@localhost wrote:
 > >Number:         47597
 > >Category:       bin
 > >Synopsis:       local and $() don't play well with each other
 > Machine: amd64
 > >Description:
 >      The following test case exhibits an error with /bin/sh and /bin/ksh
 >      that does not happen with bash:
 > 
 > -----
 > f() {
 >         echo "before setting var"
 >         local var=$(echo a=b --c=d)
 >      echo "var is: ${var}"
 >         echo "after setting var"
 > }
 
 A much simpler test shows the same feature:
     (x="a b"; b=fubar; export y=$x; echo $y; sh -c 'echo $b')
 
 Depending on the shell you either get the effect of:
        export y="a b"
 or:
        export y=a b
 
 The SUS is, as usual, tortuous. But export is a 'special builtin utility'
 so runs after normal command line processing - which includes field
 splitting.
 
 So, for export and readonly, the netbsd shells are conformant.
 I think the bash man page has a specific note about the way export (etc)
 are parsed.
 
 'local' isn't in the standard.
 
 
        David
 
 -- 
 David Laight: david%l8s.co.uk@localhost
 


Home | Main Index | Thread Index | Old Index