On Mon, Jul 18, 2011 at 10:46:19AM -0400, Steven W. Orr wrote:
> On 7/18/2011 10:14 AM, Ralph Corderoy wrote:

>>      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.

> Bash is always running in unbuffered mode, so every time a line is 
> written, it automatically gets flushed. So... The only way to write in 
> fully buffered mode with control over when things get flushed is to do it 
> from a program that is not a bash script.

If it's just about avoiding a different printf command,

    printf 'foo\nbar\n' | cat > /dev/udp/localhost/4242

(useful use of cat?) but likely not what the original poster wanted,
that is, avoiding any external command...

Reply via email to