bug-bash
[Top][All Lists]
Advanced

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

Re: Brace expansion clones <() process substitutions


From: Chet Ramey
Subject: Re: Brace expansion clones <() process substitutions
Date: Mon, 6 Nov 2000 10:48:43 -0500

> It appears the brace expansion is
> 
>    cat <( larg x ade ) <( larg x abe ) <( larg x ace )
> 
> rather than
> 
>    cat <( larg x ade abe ace )
> 
> Is this a feature or a bug?

It works this way because the <(...) is a single word to the parser and
expansion code.  Brace expansion is performed on a per-word basis, so
the output with multiple <(...) is what should be expected.

Remember that brace expansion knows little or nothing about any syntactic
interpretation of the word it's asked to expand.  It's strictly textual.

You can get close to what you want by moving the brace expansion out of
the process substitution:

larg() {
   typeset -i i=1
   while [ $i -le $# ]; do
      eval echo "\$$i"
      let i+=1
   done
}
x=$( echo a{d,c,b}e )

larg <( larg x $x )

larg <( echo x $x )

cat <( larg x $x )

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)

Chet Ramey, CWRU    chet@po.CWRU.Edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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