osx - What does {} mean in "xargs -I {} unrar x {}"? -


i new shell , i'd learn, however, seems bit complex understand:

find . \( -name *.rar \) | xargs -i {} unrar x {}

can please explain step step does. know goes folders , finds .rar files finds , chains files finds second part of command using | symbol. however, not understand xargs -i {} unrar x {} part, , {} command in particular. know unrar extracts archive.

the {} placeholder, replaced filename in generated command.

however, don't use code; behave badly rar archives having unusual names, or if there files matching *.rar in current directory (as opposed subdirectories). consider instead:

find . -name '*.rar' -exec unrar x '{}' ';' 

...or, if really want use xargs:

find . -name '*.rar' -print0 | xargs -n 1 -0 unrar x 

Comments