bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Examples of concurrent coproc usage?


From: Andreas Schwab
Subject: Re: Examples of concurrent coproc usage?
Date: Tue, 16 Apr 2024 09:56:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

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, schwab@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

[Prev in Thread] Current Thread [Next in Thread]