Bernd Eggink wrote:
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:

The pattern and `string' in ${parameter/pattern/string} aren't defined
to obey the rules of parameter brace expansions.  The search for the
matching `/' is just a string search.

It would be less confusing if the code that searched for the closing
slash were smarter about skipping over embedded brace expansions, though.
It shouldn't be too hard to change that for the next release.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    [EMAIL PROTECTED]    http://cnswww.cns.cwru.edu/~chet/


Reply via email to