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

Re: Probably very stupid script/bash question

Mark Clarkson wrote:
On Wed, 05 Mar 2008 13:10:37 -0800
Bob McGowan <bob_mcgowan@symantec.com> wrote:

Mark Clarkson wrote:
On Wed, 05 Mar 2008 12:16:02 -0800
Bob McGowan <bob_mcgowan@symantec.com> wrote:

Brian wrote:
So can you explain exactly what the first < <( echo
"$teststring" ) does exactly please?

<<<<Deleted details available elsewhere>>>>

This should explain it:

$ exec 4<>4
$ echo "this is a test" >4
$ wc /dev/fd/4
 1  4 15 /dev/fd/4

which of course is equivalent to

$ wc <(echo this is a test)

and is not a redirection!

The man page tells me that <(list) substitutes the list and it's up to
the user to choose what to do with it. I chose to redirect it, hence
the additional '< '.

I think I get it. Following through with this, regarding the error seen with 'read' and the substitution only form: 'bash: read: `/dev/fd/4': not a valid identifier', I did this, based on your setup above:

$ read a b c d /dev/fd/4
1 2 3 4
bash: read: `/dev/fd/4': not a valid identifier
$ read a b c d < /dev/fd/4
$ echo  $c $d
a test

Which is just another way of illustrating that you need to redirect the substitution.


Bob McGowan

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply to: