Chet Ramey wrote:
> Marvin Greenberg wrote:
> >         while read f; do echo $f; done <~/.bash_history
> > 
> >     But, this fails:
> >        while read f; do echo $f; done <(cat ~/.bash_history)
> >        bash: syntax error near unexpected token `<(cat ~/.bash_history)
> 
> That's not a redirection; it's process substitution.  Process substitution
> is a shell expansion that results in a filename.  Once you realize this,
> you should understand why it fails and how you can make it work.

I can't help but to post something a little more explicit.  Sorry.

  echo <(cat ~/.bash_history)
  /proc/self/fd/63

Therefore you are saying effectively this:

  while read f; do echo $f; done $FILENAME

That obviously won't work.  You need a redirection operator there.

  while read f; do echo $f; done < $FILENAME

Seeing that you can see that this is the right syntax.

  while read f; do echo $f; done < <(cat ~/.bash_history)

Bob


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to