我在一本教科书中读到 sort 命令接受来自命令行上命名的文件或标准输入的输入。我知道 cat 命令接受标准输入:
$ cat
stdin
stdin
Run Code Online (Sandbox Code Playgroud)
什么是 sort 命令的例子?
以完全相同的方式
$ sort
abc
xyz
def
Ctrl+D
美国广播公司
定义
xyz
但更多时候,它会与管道一起使用
somecommand-that-produces-unsorted-output | sort
Run Code Online (Sandbox Code Playgroud)