Instead of changing the script itself, I decided to add a special binding to Bash.
Effectively, you can write ./script.sh instead of ( ./script.sh ) | more ( ./script.sh ) | more .
Here is what you need to add to your .bashrc :
# Switch to vi mode (default is emacs mode). set -o vi dont_scroll_down() {
As a result, you can do the following:
Enter the command you want to run.
$ ./script.sh
Press Escape to exit insert mode and enter normal mode.
Now press Shift-j to execute the line.
Now you can scroll through the output from the very beginning.
source share