0

为什么会这样:

free | cut -c67- && free | cut -c55-61  

给我缓冲区和缓存大小,但是

free -s4 | cut -c67- && free -s4 | cut -c55-61  

只给我缓存大小。

4

1 回答 1

2

从 Bash 手册页:

SHELL GRAMMA
   [...]
   Lists
        AND and OR lists are sequences of one of more pipelines separated by the && and || control operators,  respec‐
        tively.  AND and OR lists are executed with left associativity.  An AND list has the form

            command1 && command2

        command2 is executed if, and only if, command1 returns an exit status of zero.

&&command1 以返回值 0 退出之前,操作员不会执行 command2。

命令free -s4 | cut -c67-,56-61更接近你想要的吗?

于 2015-08-16T14:40:21.680 回答