1

When using more or less, the output is paused at the end of each page. Is there some way to have it pause only for a few seconds (configurable or not), and then continue to the next page? Is there some other tool that can do it?

1 Answer 1

1

I remember playing with something like that in the MS-DOS age. Cute, but very unpractical.

But just as an exercise in strange things:

#!/bin/bash
while read 
do
    echo "$REPLY"
    sleep 1s
done

Save it as 'scroll' and use scroll < textfile

If you want to do a page-by-page scroll, you can use tput to determine how many rows there is in a terminal.

#!/bin/bash
while read 
do
    lines=`tput lines`
    while [ $lines -gt 0 ]
    do
        echo "$REPLY"
        read
        lines=$(( $lines - 1 ))
    done
    sleep 1s
done
3
  • Would there be a way to sleep only after filling the terminal's height?
    – entonio
    May 15, 2022 at 13:37
  • Sure, just get a number of lines on the terminal - tput lines. And print that much lines before sleep.
    – White Owl
    May 16, 2022 at 11:28
  • Would you edit your answer with tput so I could accept it? :)
    – entonio
    May 24, 2022 at 22:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .