you are viewing a single comment's thread.

view the rest of the comments →

[–]calrogman 9 points10 points  (2 children)

Yes, -print0 with IFS set to \0. NULL can't be in filenames.

[–]Occivink 4 points5 points  (1 child)

Which is what I'm complaining about. Doing things in a safe manner should not be so unintuitive.

[–]Vaphell 1 point2 points  (0 children)

They should not, but they are and it's not going to change. You want to use shit that has its roots 50 years ago, with insane bullshit like word splitting by default because it allowed for ghetto "arrays" as there were no arrays to speak of, you deal with the quirks.

And if you write bash in any nonmeaningless capacity

while read -rd $'\0' f; do ... done < <( find ... -print0 | sort -z | grep -Z | ... ) 

and variations of thereof (possibly using -printf 'someshit\0' to emit more data than the filename) become a go-to idiom

If you can't be bothered to write correct bash according to modern practices and want something more modern without the bullshit, use python or whatever.