这里有个命令
find / -perm +7000 -exec ls -l {} \;
我想这样写
find / -perm +7000 | ls -l
发现不行,为什么?
伊谢尔伦2017-04-17 12:00:05
First of all, what is a pipeline, that is, the standard output of the previous program is used as the standard input of the following program.
Thefind command will print out the found files on the terminal (standard output); if ls -l operates as 在 终端等待输入, 用户输入一个文件名, 打印出文件信息
. then this is what you want. But ls -l will not actually read the terminal.
xargs converts the standard output of the previous program into the command line parameters of the next program.
For example, if find / -perm +7000
returns /tmp/1.txt
, then the last command in find / -perm +7000 | xargs ls -l
is actually ls -l /tmp/1.txt