Linux home 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686 GNU/Linux
Bug in variable expansion using an assignment in "local" in dash:
$ x='1 2 3'
$ y=$x # this works fine
$ echo "$y"
1 2 3
$ local y=$x # this fails due to dash bug
local: 2: bad variable name
$ echo "$y"
1
The same use of assignment using "local" works fine in bash:
bash-3.2$ x='1 2 3'
bash-3.2$ y=$x
bash-3.2$ echo "$y"
1 2 3
bash-3.2$ local y=$x
bash: local: can only be used in a function
bash-3.2$ foo () {
> local y=$x
> echo "$y"
> }
bash-3.2$ foo
1 2 3
Binary package hint: dash
Linux home 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686 GNU/Linux
Bug in variable expansion using an assignment in "local" in dash:
$ x='1 2 3'
$ y=$x # this works fine
$ echo "$y"
1 2 3
$ local y=$x # this fails due to dash bug
local: 2: bad variable name
$ echo "$y"
1
The same use of assignment using "local" works fine in bash:
bash-3.2$ x='1 2 3'
bash-3.2$ y=$x
bash-3.2$ echo "$y"
1 2 3
bash-3.2$ local y=$x
bash: local: can only be used in a function
bash-3.2$ foo () {
> local y=$x
> echo "$y"
> }
bash-3.2$ foo
1 2 3