I'm confused by this experiment (in Bash):
$ mkdir 'foo\n'
$ find . -print0 | od -c
0000000 . \0 . / f o o \ n \0
0000012
As you can see, "find" is correctly delimiting the output with null characters, but it escapes the newline in the directory name as "foo\n" with a backslash "n". Why is it doing this? I told it "-print0" which says "This allows file names that contain newlines ... to be correctly interpreted by programs that process the find output." The escaping should not be necessary, since "\0" is the delimiter, not "\n".
foo\n
, with a backslash in its name.ls
you would have seen that.ls
prints exactly what I passed to mkdir,'foo\n'
...