logoalt Hacker News

ivladtoday at 12:07 AM1 replyview on HN

Was exactly my thought: why not to use null termination?

Looks like a case where reading man page would have spared writing another copycat utility.


Replies

rmunntoday at 2:33 AM

And null termination is guaranteed to work, because the only two characters forbidden in Unix filenames (for most varieties of Unix, I won't guarantee there aren't some weird variants out there) are / and null.

The only times I've needed something more than `find -print0 | xargs -0` has been when I need to apply logic to decide whether to process one of the files, in a way that's not easy to express in a `find` command. Then I write a small script with a for loop and if statements inside it.

But more people should know about `-print0`. It's the answer to 95% of the problems with `find | xargs`.