Xref: utzoo comp.unix.questions:24645 comp.unix.wizards:23435 Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!jtsv16!gerry From: gerry@jts.com (Gerry Roderick Singleton ) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: get terminal speed from shell script Message-ID: <1990Aug14.181010.29571@jts.com> Date: 14 Aug 90 18:10:10 GMT References: <90Aug12.135618edt.18763@me.utoronto.ca> <1990Aug13.005849.23223@jarvis.csri.toronto.edu> <90Aug13.095129edt.18647@me.utoronto.ca> Organization: JTS Computer Systems Ltd. Lines: 57 In article <90Aug13.095129edt.18647@me.utoronto.ca> sun@me.utoronto.ca (Andy Sun Anu-guest) writes: >In article <1990Aug13.005849.23223@jarvis.csri.toronto.edu> ruhtra@turing.toronto.edu (Arthur Tateishi) writes: >>In artcle <90Aug12.135618edt.18763@me.utoronto.ca> sun@me.utoronto.ca (Andy Sun Anu-guest) writes: >> >>>Is there a way to get the terminal speed from a (sh or csh) script? >>>I used to be able to do the following in a Bourne shell script: >>> speed=`stty speed` [lines deleted] > >I guess it depends on which version of SUN OS. "speed=`stty speed`" works >for a Sun 3/60 running (I think) SUN OS 3.x. So it does went through stdout. [more lines deleted] >>other than a proper tty device, I came up with the following. >> speed=`stty speed 3>&2 2>&1 1>&3` [more lines deleted] I like to add my two penny's worth, to query the speed of the tty device shouldn't one accept input from the device rather than perform output to it before getting the answer? The question is rhetorcal so don't bother answering it. It apppears to me to be valid in this case for BSD4.3 running on an ISIv24. Here's my little sample: #! /bin/sh speed=`stty speed &1` echo $speed and the results: /usr/local/src >%[530] sh -vx foo #! /bin/sh speed=`stty speed &1` + stty speed speed=9600 echo $speed + echo 9600 9600 /usr/local/src >%[531] I believe this satisfies Andy's requirements and I hope it's what he wanted. Anyways it'll fuel the discussion. Cheers, ger -- -- G. Roderick Singleton, System and Network Administrator, JTS Computers {uunet | geac | torsqnt}!gerry@jtsv16.jts.com