1. 14
  1.  

  2. 1

    I suppose that’s why commands like xargs or find accept -0 as an argument in order to use null bytes as separators.

    1. 5

      Only rather indirectly. Because Unix uses null-terminated strings for paths, \0 is the only byte that is guaranteed to never appear in a valid Unix path. As such it’s the only safe byte that can be used to separate paths in a stream of them, such as what find produces. You can’t safely use eg newlines, because in theory some joker could put a newline in their filename and screw you up.

      (xargs also has unfortunate default semantics where even spaces are separators, not just newlines. And people put spaces into filenames all the time. In theory xargs could have a ‘just newlines’ switch; in practice everyone immediately goes all the way to -0 because that solves the entire problem for sure.)