在尝试改进 的输出时hg diff
,我注意到less
的-F
选项无法与其-S
选项一起使用。为什么会发生这种情况?我该如何实现所需的效果?
以下摘录自man
:
-F or --quit-if-one-screen
Causes less to automatically exit if the entire file can be dis-
played on the first screen.
-S or --chop-long-lines
Causes lines longer than the screen width to be chopped rather
than folded. That is, the portion of a long line that does not
fit in the screen width is not shown. The default is to fold
long lines; that is, display the remainder on the next line.
less 444
已在和上测试less 436
。
解释
我错误地认为这样-S
可以减少多余的字节。内容会移到屏幕右侧。
为了实现我的愿望,我只需使用(...) | cut -b -80 | less -FSX
。
答案1
对我有用;less -FS
如果输入可以在一个屏幕上打印而没有折叠线,则立即退出,如果需要滚动(向右或向下),则正常运行。