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

Probably very stupid script/bash question



Hi,

I tried using bash to split a string. This works OK:

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

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.

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

Thanks in advance

Cheers Brian


Reply to: