On Apr 16 2024, Carl Edquist wrote:

> Well, you _can_ shovel binary data too: (*)
>
>       while IFS= read -rd '' X; do printf '%s\0' "$X"; done
>
> and use that pattern to make a shell-only version of tee(1) (and I suppose
> paste(1)).  Binary data doesn't work if you're reading newline-terminated
> records, because you cannot store the NUL character in a shell
> variable. But you can delimit your records on NULs, and use printf to
> reproduce them.

Though that will likely add a spurious null at EOF.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

Reply via email to