2015-09-28 41 views

回答

1
$ ls -al | head -n 1 
total 57600 

此行不显示-1

+0

Ignacio,我很抱歉,但这是如何帮助我上面的问题? – Albert

+0

除直接回答外? –

+0

您的评论证明了什么? – Albert

0

|是连接命令的管道,左命令ls -al的输出是右命令wc -l的输入。

命令的输出ls -al是字符串,然后wc -l将字符串作为文件内容计数,字符串内容中的文件名不是命令wc -l的参数。

命令xargs很有用,你可以使用它。 like:

ls -a | xargs wc -l 
# find command to find files 
find ./* | xargs wc -l