LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Bash question - serial port

[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
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell