Mark Clarkson wrote:
On Tue, 04 Mar 2008 18:46:05 +0100
Brian <[EMAIL PROTECTED]> wrote:
I could not get this to work, the shell complains:
./dirvish-mail.sh: 98: Syntax error: redirection unexpected
Interesting to note that this does not work under busybox. I think
this is rather an esoteric but often useful bash feature. (It also
needs /proc so is not available in some special cases.)
The other solution from Alex:
>> echo "$teststring" | ( read A B C D E F; )
Of course, both solutions work perfectly under bash.
This should not have worked under bash either since it is still running
in a sub-shell, so the variables are lost when read finishes.
Mark,
of course you are correct. I had written the following test script:
=================================================================
#!/bin/bash
teststring="one two three four five six"
{ read A B C D E F; } < <( echo "$teststring" )
echo "Data received = $E Bytes"
echo "$teststring" | ( read A B C D E F; )
echo "Data received = $E Bytes"
=================================================================
$E was still set from the first read call. Duuh.
So can you explain exactly what the first < <( echo "$teststring" )
does exactly please?
Cheers Brian
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]