On 9/22/18 12:38 PM, Ilkka Virta wrote: > On 22.9. 02:34, Chet Ramey wrote: >> Newline? It's probably that stdout is line-buffered and the newline causes >> a flush, which results in a write(2). > > Mostly out of curiosity, what kind of buffering logic does Bash (or the > builtin > printf in particular) use? It doesn't seem to be the usual stdio logic where > you get > line-buffering if printing to a terminal and block buffering otherwise. I get > a > distinct write per line even if the stdout of Bash itself is redirected to say > /dev/null or a pipe: > > $ strace -etrace=write bash -c 'printf "foo\nbar\n"' > /dev/null > write(1, "foo\n", 4) = 4 > write(1, "bar\n", 4) = 4 > +++ exited with 0 +++ Oh. But thanks anyway! coreutils in fact does it in one shot as you indicated. Dirk
- bash sockets: printf \x0a does TCP fragmentation dirk+bash
- Re: bash sockets: printf \x0a does TCP fragmentation Chet Ramey
- Re: bash sockets: printf \x0a does TCP fragmentation dirk+bash
- Re: bash sockets: printf \x0a does TCP fragmentation Ilkka Virta
- Re: bash sockets: printf \x0a does TCP fragmentat... dirk+bash
- Re: bash sockets: printf \x0a does TCP fragmentat... Chet Ramey
- Re: bash sockets: printf \x0a does TCP fragmentation Bob Proulx
- Re: bash sockets: printf \x0a does TCP fragmentation dirk+bash
- Re: bash sockets: printf \x0a does TCP fragmentat... Ilkka Virta
- Re: bash sockets: printf \x0a does TCP fragmentat... Bob Proulx
- Re: bash sockets: printf \x0a does TCP fragme... Chet Ramey
- Re: bash sockets: printf \x0a does TCP f... Bob Proulx
- Re: bash sockets: printf \x0a does T... Bob Proulx