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

Re: Probably very stupid script/bash question



Michelle Konzack wrote:
Am 2008-03-05 14:13:33, schrieb Brian:
teststring="one two three four five six" { read A B C D E F; } < <( echo "$teststring" ) echo "Data received = $E Bytes"
------------------------ END OF REPLIED MESSAGE ------------------------

This look a little bit weird. Why not use:

----8<--------------------------------------------
read A B C D E F <<EOF
one two three four five six
EOF
----8<--------------------------------------------

and

----8<--------------------------------------------
teststring="one two three four five six"
read A B C D E F <<EOF
$teststring
EOF

echo "Data received = $E Bytes" ----8<--------------------------------------------

no need for a stupid resources eating subschell expecialy on a ARM.

:-)


Actually, the example code is a trivial example used to illustrate how to use "process substitution". A real case might have a series of commands running, or a single large application, etc., from which you want to read the output in some asynchronous way.

In some cases, using a here doc would be an option, but in the cases mentioned above, you don't know what the text will be until you fetch it. It's a run time issue.

--
Bob McGowan

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


Reply to: