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
[EMAIL PROTECTED]
http://sudrala.de


Reply via email to