Xref: utzoo comp.unix.wizards:23408 comp.unix.questions:24587 Path: utzoo!utgpu!news-server.csri.toronto.edu!turing.toronto.edu!ruhtra Newsgroups: comp.unix.wizards,comp.unix.questions From: ruhtra@turing.toronto.edu (Arthur Tateishi) Subject: Re: get terminal speed from shell script Message-ID: <1990Aug13.005849.23223@jarvis.csri.toronto.edu> Organization: CSRI, University of Toronto References: <90Aug12.135618edt.18763@me.utoronto.ca> Date: 13 Aug 90 04:58:49 GMT Lines: 29 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` >and got the terminal speed assigned to variable speed. As various OS >gets updated (e.g. Ultrix 3.1 and SUN OS 4.0.3), this won't work anymore >because all stty outputs are being sent to stderr, not stdout, thus no >piping or redirection is possible. Is there any similar commands that can >get terminal speed inside a shell script? I find it odd that the SUN man pages still specify option info is output on stdout... Maybe I shouldn't be surprised. However, I since stty seems to go bonkers when stdout goes to something other than a proper tty device, I came up with the following. speed=`stty speed 3>&2 2>&1 1>&3` This essentially swaps stdout and stderr with a dangling file descriptor 3 which could be closed with 3>&- however it shouldn't matter. Be warned, if stderr has been modified to be a socket going somewhere, it will likely blow up with 'stty: Operation not supported on socket.' so you could use speed=`stty speed 2>&1 1>/dev/tty` which also has its drawbacks. Sorry, I can't confirm this for Ultrix. -- ``Sex and drugs? They're nothing compared with a good proof!'' - A Cambridge student (r.h.f) Arthur Tateishi g9ruhtra@zero.cdf.utoronto.edu