Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!ames!ptsfa!ihnp4!cbosgd!osu-cis!tut!lvc From: lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) Newsgroups: comp.unix.wizards Subject: Re: Pager in the shell Message-ID: <504@tut.cis.ohio-state.edu> Date: Sat, 17-Oct-87 08:10:52 EDT Article-I.D.: tut.504 Posted: Sat Oct 17 08:10:52 1987 Date-Received: Sun, 18-Oct-87 11:33:10 EDT References: <9779@brl-adm.ARPA> Organization: Ohio State Computer & Info Science Lines: 49 Summary: well it almost works In article <9779@brl-adm.ARPA>, mills%cc.uofm.cdn%ubc.csnet@RELAY.CS.NET (Gary Mills) writes: > Has anyone succeeded in putting a pager into the shell? I am getting > a bit tired of appending ` | pg' to any command line that I suspect > will generate more than a screen of output. It should be smart enough > to reset its line count at each shell prompt so I don't have to keep > clearing the screen before commands. I'm not asking for too much, > am I? :-) This is System V and we have source. > > -Gary Mills- > -University of Manitoba- > -Winnipeg, Canada- I tried to do this without writing another C program. I put this in an executable shell file called 'page': exec /bin/sh | pg When you want pagination, type in page, and all the output from /bin/sh and all the commands you execute will go to pg. Now the bad part, I couldn't get pg to read its input line by line, maybe theres some option? You could probably change pg to get the behavior you want. I think sh line buffers its output so hopefully you won't have to change it too. I also tried this initially, exec /bin/sh 2>&1 | pg But sh sends PS1 and PS2 down stderr and pg didn't print them, not sure why, maybe the buffering again (or perhaps PS1 should have a newline in it). This also has the disadvantage that stderr is always sent down the pipe. Once you type in ^D you'll be back at your login shell so you can use commands like vi. When all else fails change the tty driver. Someone already suggested this, but I think it may have been premature. We os types love to change things, especially the kernel! When all *else* fails, change the kernel, or buy piece of hardware to do this. I have a terminal with 4 screens of local screen memory (a Teletype 4425), and I can see any of it with some special keys on the left side of the keyboard. I wouldn't say your asking for too much just something most UNIX* users don't need. Personnally I would be very annoyed with it, but that doesn't matter. Larry Cipriani cbosgd!osu-cis!tut!lvc (just a partime grad student) * UNIX is a registered trademark of Ken Thompson.