> Is there any legitimate use for filenames with newlines?
IMHO no, but they can exist, so you need to handle them without blowing up. Also, even spaces are considered delimiters here, which is why it's bad form to parse the output of ls.
$ touch "foo bar baz"
$ for f in `ls`; do echo $f; done
foo
bar
baz
# always use double quotes, though they aren't needed here
$ for f in *; do echo "$f"; done
foo bar baz
At least the OS guarantees you won't run into NUL though.
IMHO no, but they can exist, so you need to handle them without blowing up. Also, even spaces are considered delimiters here, which is why it's bad form to parse the output of ls.
At least the OS guarantees you won't run into NUL though.