Linux why can't I pipe find result to rm?

后端 未结 5 1610
伪装坚强ぢ
伪装坚强ぢ 2020-12-12 12:52

sorry if this is a noobie question but I can\'t find a good answer.

To find then remove something I can use

find . -name \".txt\" -exec rm \"{}\" \\;         


        
5条回答
  •  悲哀的现实
    2020-12-12 13:27

    Pipe sends output of first command to the standard input of second. rm does not accept standard input so you can't pipe to it. You could use xargs to achieve the same effect. You can find example for xargs specifically for your case in man page for xargs.

提交回复
热议问题