GNU find has a -print0 option to terminate filenames with null characters. However, this option is not available in POSIX find.
In the GNU man page for find, under the -print flag, it says:
If you are piping the output of
findinto another program and there is the faintest possibility that the files which you are searching for might contain a newline, then you should seriously consider using the-print0option instead of
This suggests to me that -print0 was introduced by GNU to specifically handle file paths with newline characters.
What alternative is available in POSIX for GNU's -print0 option, using either just POSIX find or piping to a second POSIX command?
-print0, then I assume you will also need to find POSIX alternatives to handling that output? Why not just use-execto process the pathnames directly? – Kusalananda Feb 05 '21 at 20:54-print0does, but if-print0was designed specifically for the purpose of piping the output toxargs -0(which is also non-POSIX), then I guess there's no reason to try to find an alternative to-print0in POSIX. – Shane Bishop Feb 05 '21 at 22:40-print0to handle newline characters in paths (see my quote in my question). This (to me at least) makes it seem less likely that my question is a duplicate of How do I use find when the filename contains spaces?. Even if the answer to that question answers my question, the two questions IMO are different. – Shane Bishop Feb 06 '21 at 15:55