[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash-3.1.1 parses arrays slightly incorrectly
From: |
Mike Frysinger |
Subject: |
Re: bash-3.1.1 parses arrays slightly incorrectly |
Date: |
Sat, 24 Dec 2005 15:46:13 -0500 |
User-agent: |
KMail/1.9 |
On Saturday 24 December 2005 13:27, Chet Ramey wrote:
> Mike Frysinger wrote:
> > On Thu, Dec 22, 2005 at 09:24:06AM -0500, Chet Ramey wrote:
> >> Bash-Release: 3.1
> >> Patch-ID: bash31-001
> >>
> >> Bug-Description:
> >>
> >> There are parsing problems with compound assignments in several
> >> contexts, including as arguments to builtins like `local', `eval', and
> >> `let', and as multiple assignments in a single command.
> >
> > still seems to be a slight regression here with arrays ...
>
> Try this:
maybe ... it fixed the setting of the array yes, but now i'm not sure if the
behavior i'm seeing is a regression or a bugfix ... here is a slightly
expanded test case from before:
expand_parameters() {
local x=$( eval echo ${@// /_} )
local -a a=( ${x} )
a=( ${a[@]/#/\"} )
a=( ${a[@]/%/\"} )
echo "${a[*]//_/ }"
}
iface_start() {
local i
local -a config a
a=( "${config_lo}" )
for (( i=0; i<${#a[@]}; i++)); do
local -a b=( $( expand_parameters "${a[i]}" ) )
config=( "${config[@]}" "${b[@]}" )
done
echo ${config[@]}
}
config_lo=( "127.0.0.1/8 brd 127.255.255.255" )
iface_start
bash-3.1 will now show "127.0.0.1/8 brd 127.255.255.255"
bash-3.0 shows 127.0.0.1/8 brd 127.255.255.255
in other words, 3.1 includes the "" in the output
-mike