On 07/07/2011 06:55 AM, Steven W. Orr wrote: > So, why is it that bash is behaving like it is always line buffered or > unbuffered, even if there is no console?
Because POSIX requires 'sh' to behave like it is unbuffered: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html When the shell is using standard input and it invokes a command that also uses standard input, the shell shall ensure that the standard input file pointer points directly after the command it has read when the command begins execution. It shall not read ahead in such a manner that any characters intended to be read by the invoked command are consumed by the shell (whether interpreted by the shell or not) or that characters that are not read by the invoked command are not seen by the shell. Bash meets this requirement by reading one byte at a time on non-seekable input, rather than relying on the decision of libc on whether stdin defaults to fully-buffered or line-buffered. -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature