Distributions
› Ubuntu
› Fedora
› CentOS
中文资源站
› 网易开源镜像站
James369
V2EX  ›  Linux

less 命令在与管道工作时,为什么会自动退出交互模式?

  •  
  •   James369 · Dec 18, 2020 · 2230 views
    This topic created in 2150 days ago, the information mentioned may be changed or developed.
    当直接 less xxx 文件时,是处于一种交互模式,即可以进行上下翻页操作。
    但是在 less xxx | grep yyy 时,它就会自动退出交互模式,而直接将文件全部内容输出到 grep 命令。

    less 命令是如何识别到当前所处的执行环境的?
    3 replies  •  2020-12-18 10:56:44 +08:00
    lululau
    lululau
    Dec 18, 2020❤️1
    1
    man 3 isatty
    James369
    James369
    OP
    Dec 18, 2020
    3
    明白了,漂亮。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1727 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 12:28 · PVG 20:28 · LAX 04:28 · JFK 07:28
    ♥ Do have faith in what you're doing.