Thanks a lot for your input, I will try them tonight and report back
which one works the best.
Another thing is that if somebody pulls out the usb 2 serial adapter
the script fails and exits.
I want it to continue or restart if the device has been put back.
I have come up with this (but haven't tried it yet):
while true; do
# Make sure the boudrate is set correctly
stty -F /dev/ttyUSB0 57600
while read -r; do
echo "[$(date)]: $REPLY"
done </dev/ttyUSB0 >>/usb/BigDrive/CurrentCost/CurrentCost.log
# Try again in 10 seconds
sleep 10
done
Rather than trying to read from /dev/ttyUSB0 is there a way to check whether
it is connected?
Regards
On 26 March 2010 06:34, Doug Clapp <[email protected]> wrote:
>
>
> Cathey, Jim wrote:
>>>
>>> Is there an easy way to disregard lines that contain only control
>>> characters or filter the text?
>>>
>>
>> Not trivially. As you've been shown, "tr -d" is your
>> buddy.
>
> Another possibility is to pipe through dos2unix (rather than tr) to remove
> the CR characters. Ultimately you have to decide which method works best for
> you.
>
> Doug Clapp
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox