Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Possible bug with parameter expansion



On Mar 7, 11:36am, Oliver Kiddle wrote:
} Subject: Possible bug with parameter expansion
}
} The ${name:#pattern} form of parameter expansion doesn't work within
} double quotes. It is acting as if the pattern matched all the elements.

If you read Peter's 11-step "summary of the rules for substitution" you
will see that (4. *Double-Quoted Joining*) comes before (6. *Modifiers*).

} % echo "${(M)a:#*=*}"
} a d=rt b=fg c e=yt

zagzig% echo "${(@M)a:#*=*}" 
d=rt b=fg e=yt

} This looks like a bug to me because I can't see why the double quotes
} should be affecting the result.

Because they do.  I don't recall why joining happens before modifiers,
but I'm pretty sure there was a good reason for it at the time.  Does
this disagree with other shells that support ${var#pat}, e.g. ksh?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author