How to automatically pipe to less if the result is more than a page on my shell?

前端 未结 5 656
梦如初夏
梦如初夏 2021-02-01 03:41

Mostly, I will not use | less for each and every command from the shell.

Pipe to less is used only when I actually run the command without is and find out t

5条回答
  •  醉梦人生
    2021-02-01 04:22

    In general, automatically piping to less requires the shell to be prescient about the output that will be produced by the commands it runs - and it is hard enough for humans to predict that without trying to make programs do so.

    You could write a shell that does it for you - that captures the output (but what about stderr?) and paginates if necessary, but it would most certainly not be a standard shell.

提交回复
热议问题