ls命令按行输出结果:
AndroidSandbox/ kotlin-native-intellij/
arc-theme-macos/ kotlin-native-sandbox/
BobkoLauncher/ kotlin-ref-delegation/
...
Run Code Online (Sandbox Code Playgroud)
如何获取n此输出的第一行?ls | head -n 2不起作用,因为它需要两个第一个文件,但我需要两个第一行输出。
简短回答:
unbuffered ls | head -n 2
解释:
https://unix.stackexchange.com/questions/249723/how-to-trick-a-command-into-thinking-its-output-is-going-to-a-terminal
| 归档时间: |
|
| 查看次数: |
6745 次 |
| 最近记录: |