bug-bash
[Top][All Lists]
Advanced

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

bash-3.1.1 parses arrays slightly incorrectly (was: Bash-3.1 patch 1)


From: Mike Frysinger
Subject: bash-3.1.1 parses arrays slightly incorrectly (was: Bash-3.1 patch 1)
Date: Fri, 23 Dec 2005 17:23:59 +0000
User-agent: Mutt/1.5.11

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 ...

for example, consider this stripped down script:
expand_parameters() {
    local x=$( eval echo ${@// /_} )
    local -a a=( ${x} )
    a=( ${a[@]/#/\"} )
    a=( ${a[@]/%/\"} )
    echo "${a[*]//_/ }"
}
iface_start() {
    local -a a
    a=( "${config_lo}" )
    expand_parameters "${a[0]}"
}
config_lo=( "127.0.0.1/8 brd 127.255.255.255" )
iface_start

if we run this with <=bash-3.0, we get:
"127.0.0.1/8 brd 127.255.255.255"
with bash-3.1 though, we get no output at all ...

changing expand_parameters() slightly is one workaround:
-    local -a a=( ${x} )
+    local -a a ; a=( ${x} )
-mike




reply via email to

[Prev in Thread] Current Thread [Next in Thread]