> No way to hand echo or /bin/echo a NULL.
You mean NUL, not NULL. And printf can do it.
> $ set a $'\x00' b
> $ echo $#
> 3
> $ echo A$'\x01'B|wc -c
> 4
> $ echo A$'\x00'B|wc -c
> 3
Here, command substitutions strip all NULs from the command's
output. POSIX doesn't specify whether this behavior is allowed
or not, but I think it makes more sense for command substitution
to strip NULs than to risk the inconsistency of arguments being
chopped short as they are passed through exec() calls.
--
Eric Blake