bug-bash
[Top][All Lists]
Advanced

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

Re: Bash string substitution bug (?)


From: Chet Ramey
Subject: Re: Bash string substitution bug (?)
Date: Fri, 11 Jan 2008 13:44:25 -0500
User-agent: Thunderbird 2.0.0.9 (Macintosh/20071031)

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.  The fact
that Korn chose to implement it a certain way in ksh and not document
the implementation doesn't help compatibility, but the public
specification of the feature is the same between both shells.

Chet

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




reply via email to

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