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

Re: Probably very stupid script/bash question



Georg Neis wrote:
Brian wrote:

The following does not (the value is empty):

echo "$teststring" | { read A B C D E F; }
echo "Data received = $E Bytes"  <--- $E is empty

I assume it has something to do with the read command being executed in
a subshell.

Yes.

So how can I extract the parts I want into variables to use them later
on in the script?

$ teststring='field1 field2 field3'
$ set -- $teststring
$ echo $2
field2

Regards,
Georg


Georg,

this works perfectly thanks.

Cheers Brian


Reply to: