I have folder named play which contains a file damn file (with space). When I use find and pipe the output to tar:
find play/ -name 'damn*' | tar cf archive.tar -T -
It works perfectly. Why does this works The output of find contains space that should cause problem for tar. When I use this command:
tar cf archive.tar $(find play/ -name 'damn*')
bash shows these errors:
tar: play/damn: Cannot stat: No such file or directory
tar: file: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
I'm confused. Why does the first example work?