I have a linux bash script.sh. I can easily scroll the output like this:
$ ./script.sh | less
You can write your script like this:
#!/bin/bash ( Your script here ) | less exit $PIPESTATUS
This will pipe the script output through
less if output is a terminal (so you can
./script.sh > file without paging), and it preserves the script's exit code.