Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why | doesn't work with find?

Tags:

linux

bash

shell

Why does the following command aiming to remove recursively all .svn folders

   find . -name ".svn" | rm -rfv

doesn't work ?

I know the find command provides the -exec option to solve this issue but I just want to understand what is happening there.

like image 930
Manuel Selva Avatar asked Dec 06 '22 00:12

Manuel Selva


1 Answers

In your example, the results from find are passed to rm's STDIN. rm doesn't expect its arguments in STDIN, though.

Here is an example how input redirecting works.

like image 118
Linus Kleen Avatar answered Dec 20 '22 09:12

Linus Kleen