Re: basic command pipe question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Todd Zullinger <tmz@xxxxxxxxx> writes:

> One thing that would bite you on a for loop like this is files with
> spaces in them.  Using a while loop is one way to get around that if
> you want to do the rm one at a time for whatever reason:
> 
> find -iname "*.zip" | while read i; do rm "$i"; done;

Why not use

find -iname "*.zip" -exec rm {} \;

I'm quite sure that this deals with spaces just fine. The {} is replaced
with the file name for each file found by find, and the \; indicates the
end of the command given by -exec.

Regards
Ingemar


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux