Gracefully degrade less to cat for output not exceeding one page

by jenny on 20 January 2014 - 09:19pm in

echo "hi" | less -FX

From man less:

       -F or —quit-if-one-screen
              Causes less to automatically exit if the entire file can be displayed on the first screen.

       -X or —no-init
              Disables sending the termcap initialization and deinitialization strings to the terminal.  This is sometimes desirable if the deinitialization  string  does  something  unnecessary,  like
              clearing the screen.