To create a test file contains blanks in the filename first:
vim "/tmp/it is a test.txt"
bash escape
Search with grep:
grep -lr 'bash' /tmp
/tmp/it is a test.txt
I want to grep command after the grep:
grep -lr 'bash' /tmp | xargs grep escape
grep: /tmp/it: No such file or directory
grep: is: No such file or directory
grep: a: No such file or directory
grep: test.txt: No such file or directory
So i add -0 in xargs:
grep -lr 'bash' /tmp | xargs -0 grep escape
grep: /tmp/it is a test.txt
: No such file or directory
I find the reason:
grep -lr 'bash' /tmp | xargs -0
grep: /tmp/it is a test.txt
#a blank line at the bottom
xargs -0 add a blank line!
How can suppress the output : No such file or directory ?