Jon Seymour wrote: > On Mon, Feb 16, 2009 at 10:22 AM, Paul Jarc <p...@po.cwru.edu> wrote: >> Jon Seymour <jon.seym...@gmail.com> wrote: >>> If the builtin echo fails it will be because the bash interpreter >>> has suffered a catastrophic failure of some kind [ e.g. run out of >>> memory ]. Once that has happened, all bets are off anyway. >> >> Probably true, but command substitution forks a separate process, so >> that can fail for reasons external to the bash process. >> >> Here's another possibility: >> CPATH=${CPATH:+$CPATH:}${#+~usr1/blah/blah} >> > > Paul, > > Out of interest, how does one derive that outcome from the documented > behaviour of bash? That is, which expansion rules are being invoked?
${#+~usr1/blah/blah} probably refers to $#. Strangely, this variable seems to be defined even when not executing any function. However, in this case "echo $#" prints "$#"! The expansion rules are exactly two: ${parameter:+word} (http://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameters, 3.5.3 Shell Parameter Expansion) and ${parameter} (3.5.3 Shell Parameter Expansion) -Angel