Hi,
(I'm not subscribed to the list so please keep me CC'd.)
Consider
printf 'foo bar\n' >/dev/udp/localhost/4242
with bash's printf built-in, it works fine. One packet is sent.
However, make that two lines
printf 'foo\nbar\n' >/dev/udp/localhost/4242
and two packets are sent, one per line. If the aim is to send a string
of data in one packet this causes problems.
Using /usr/bin/printf from coreutils gives one write(2), so that's a
possible workaround.
Is this happening because the built-in printf is using putchar(3) in the
PC() macro and stdio thinks file descriptor 1 is still to a tty so it's
persisting in line buffering? It would seem nicer if fewer write(2)s
were done when stdout isn't a tty, and not just for UDP use.
Cheers, Ralph.