On Fri, May 11, 2001 at 11:14:08AM +0100, Matthew Byng-Maddick wrote:
> On Fri, 11 May 2001, Dominic Mitchell wrote:
> > On Fri, May 11, 2001 at 11:41:20AM +0200, Philip Newton wrote:
> > > Dominic Mitchell wrote:
> > > > assuming you can get into a bourne shell, you can
> > > > still do things like write cat(1) in sh, as well.
> > > This is not going to help you pause output.
> > > > Although it'd be hard to control without ^S and ^Q,
> > > ...which was what the original post was all about.
> > No, you'd need the maths operators that came with later shells, so you
> > could work out lines. Dammit, I'm going to have to write shmore now.
> > #!/bin/sh
> > lineno=1
> > while read line
> > do
> > lineno=$((lineno+1))
> > if [ $(($lineno % 24)) = 0 ] ; then
> > echo -n " -- more -- "
> > read ans </dev/tty
> > test $ans = "q" && exit 0
> > fi
> > done
> That breaks if the line is longer than the width of your screen.
< echo "$line"
> echo `echo "$line" | dd bs=79 count=1 2>/dev/null`
P.S. Why are we doing this in sh(1)??