0

In a script, I’m doing a git diff that I want to quickly page through. When I’m finished, the pager will exit and the script will continue.

more is great for the task, because I can space through it and it will exit at the end of the file. Unfortunately, instead of the diff colours it shows the control characters.

less shows the colours just fine, but when reaching the end of the file it does not exit, q is needed.

How do I get both colour support and exiting on last space? No external tools can be added, only what comes with a default macOS installation.

2
  • 2
    Add -E to less. Commented Nov 18, 2021 at 23:51
  • @llua Thank you. If you want to add that as an answer, I’ll accept it. Commented Nov 19, 2021 at 18:45

1 Answer 1

0

From less’s man page:

-E or --QUIT-AT-EOF
          Causes less to automatically exit the first time it reaches end-of-file.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.