bug-bash
[Top][All Lists]
Advanced

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

Re: Bash string substitution bug (?)


From: Bernd Eggink
Subject: Re: Bash string substitution bug (?)
Date: Fri, 11 Jan 2008 21:30:06 +0100
User-agent: Thunderbird 2.0.0.9 (X11/20071031)

Chet Ramey schrieb:
Bernd Eggink wrote:

      prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}}
      output:             -bash: ${HOSTNAME: bad substitution

Apparently bash interprets this as  ${parameter/pattern/string}
where pattern = ${HOSTNAME. Looks like a bug; it works in ksh.

That is, in fact, what is happening.  I'm not sure you can call it
a bug, though -- bash is behaving exactly as documented.

Where exactly is that documented? The only statement I can find in the documentation referring to this problem is:

"When braces are used, the matching ending brace is the first `}' not escaped by a backslash or within a quoted string, and not within an embedded arithmetic expansion, command substitution, or parameter expansion."

I may be wrong, but to me this means that the first opening brace matches the last closing one, and that the token ${HOSTNAME/.*} is a correct parameter expansion.

Bernd

--
Bernd Eggink
monoped@sudrala.de
http://sudrala.de




reply via email to

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