get terminal speed from shell script

Gerry Roderick Singleton gerry at jts.com
Fri Aug 17 13:44:01 AEST 1990


In article <12584 at hydra.gatech.EDU> gt0178a at prism.gatech.EDU (BURNS,JIM) writes:
>in article <1990Aug14.181010.29571 at jts.com>, gerry at jts.com (Gerry Roderick Singleton ) says:
>> #! /bin/sh
>> 
>> speed=`stty speed </dev/tty 2>&1`
>> echo $speed
>
>Nope, on SunOS 4.0, you get:
>
>{richsun12:/usr}
>[196] t=`stty speed </dev/tty 2>&1`
>{richsun12:/usr}
>[197] echo $t
>stty: Operation not supported on socket
>{richsun12:/usr}
>[198]
>-- 

Hmm, that's true when you're in a window.  I did not interpret the
original question as being window specific but the more general
case of working with ttys and pttys.  The script DOES work for real
ttys and ti even works on pttys over RPC links.  Here's the output
under these circumstances as executed with /bin/sh -vx foo, where foo
is the four lines above:

#! /bin/sh

speed=`stty speed </dev/tty 2>&1`
+ stty speed 
speed=9600
echo $speed
+ echo 9600 
9600

I have no window system solution, so I hope one of the window system
gurus can help.

ger
-- 
--
G. Roderick Singleton, System and Network Administrator, JTS Computers 
	{uunet | geac | torsqnt}!gerry at jtsv16.jts.com



More information about the Comp.unix.questions mailing list