[ILUG] Bash question - serial port
P at draigBrady.com
P at draigBrady.com
Fri Feb 25 13:19:35 GMT 2005
newboid at vodafone.ie wrote:
> Hi,
>
> I am quite new to linux and I was wondering if there is a way to get a string
> from a serial port from the shell?
>
> I have tried using:
>
> cat < /dev/ttyS0
>
> and I can see the string from the serial port, but I don't seen to see a
> way of terminating the cat command to get at the data.
>
> I looked at C and it seems a bit complex for what I want to do.
If you know exactly how much data there will be you could do:
dd if=/dev/ttyS0 bs=1 count=$number_of_bytes
If it's line oriented data then I suppose you could do:
while read /dev/ttyS0
echo received: $REPLY
done
--
Pádraig Brady - http://www.pixelbeat.org
--- Following generated by rotagator ---
Wondering what the optimum flags for your
compiler and CPU combination?
http://www.pixelbeat.org/scripts/gcccpuopt
--
More information about the ILUG
mailing list