Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!apple!voder!pyramid!jimmy From: jimmy@pyrps5 (Jimmy Aitken) Newsgroups: comp.unix.wizards Subject: Re: Reading raw input from /dev/tty using shell Message-ID: <64525@pyramid.pyramid.com> Date: 29 Mar 89 19:17:17 GMT Sender: daemon@pyramid.pyramid.com Reply-To: jimmy@pyrps5.pyramid.com (Jimmy Aitken) Organization: Pyramid Technology Corp., Mountain View, CA Lines: 22 In article <52@crdgw1.crd.ge.com> barnett@crdgw1.crd.ge.com (Bruce Barnett) writes: >Does anyone know a clever method of reading raw data from /dev/tty >using a shell script and standard Unix tools? This is the method that I shell script that I use to chnage attributes of a sun window. The main program has lots of options and needs to know the current position of the window read via escape sequences. Note that you musn't type anything whilst it's trying to read the input as it would get messed up with the stuff that the sun window is "typing". This runs fine under sunOS 3.5 The code fragment goes something like: stty raw > /dev/tty echo -n "escape sequencs that causes the string to be returned" > /dev/tty ch=`dd /dev/null` stty cooked > /dev/tty This can be used e.g: echo -n "${esc}[18t" to get the size of the window >Call me a purist, but I was wondering if I could replace a 10 line C program >with a 5 line shell script? :-) Or even 4 line...