bug-bash
[Top][All Lists]
Advanced

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

Re: printf -u "$fd"?


From: Chet Ramey
Subject: Re: printf -u "$fd"?
Date: Mon, 20 May 2024 15:03:23 -0400
User-agent: Mozilla Thunderbird

On 5/17/24 10:53 PM, Zachary Santer wrote:

So here's another tangent, but has it been considered to add an option
to the printf builtin to print to a given file descriptor, rather than
stdout? If printing to a number of different file descriptors in
succession, such an option would appear to have all the same benefits
as read's -u option.

It doesn't actually save anything; it's just syntactic sugar. Since
`printf' uses stdio internally (as opposed to `read', which uses the
supplied file descriptor directly), you're still going to have to dup2
it internally somewhere. dprintf could do some of the work here, and bash
has a replacement for systems where it's missing, but that's more than I
want to change before bash-5.3 comes out. Maybe after that.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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