Background—convo section:
"Bash is evolving. Could it one day do NUL separation natively, so that
pure streaming in cases like the one at hand won't force usage of 1 more
external tool, like for example tr?
.
GPT-5 mini
Yes — it's technically plausible and desirable. Brief points:
Mechanisms that would enable it:
Add a flag to core utilities or shell builtins to output NULs
(e.g., ls --zero/-z like find/sort do). If ls gained a
standardized -z, your original pipeline could be purely
builtin+streaming.
Extend bash's I/O and read utilities to support converting record
separators in a streaming way (e.g., a builtin like printf -z or a
builtin tr-like option, or an option to process-substitution to
request a different record separator).
Provide a bash builtin filter (e.g., bash::tr, or a shell builtin
that maps IFS/newline→NUL while streaming) so no external binary
is required.
Add mapfile/readarray a -z streaming mode that reads NUL-delimited
input or emits NULs on demand without buffering the whole array.
Practical likelihood and constraints:
Feasible: bash already supports -d for read and mapfile, and
process substitution; adding explicit NUL-aware streaming builtins
is implementable.
Friction: backwards compatibility, portability, and the fact that
many existing tools (ls historically) don't provide -z means
change would need coordination across GNU coreutils and shells.
More likely short-term: individual utilities (find, sort, GNU ls)
add -z/--zero flags (some already have); a dedicated small builtin
in bash is possible but would need maintainers' approval.
What to watch for / how to follow:
Follow bash changelogs and proposals (bash mailing list, NEWS).
Watch GNU coreutils (ls) for a --zero option and related utilities
adding -z support.
Follow POSIX discussions if you want wider portability.
Summary: technically straightforward and plausible, but adoption depends
on shell/coreutils maintainers and portability concerns. In practice
you’ll likely see more tools gain -z options before bash ships a dedicated
builtin streaming NUL-converter."