writing zero bytes in bash

Russell Coker russell at coker.com.au
Sat Feb 26 21:48:57 UTC 2005


On Sunday 27 February 2005 06:28, Alexandre Oliva <aoliva at redhat.com> wrote:
> On Feb 26, 2005, Russell Coker <russell at coker.com.au> wrote:
> > Actually I am not asking for a feature to be added, but for a feature to
> > be removed.  There is special-case code in bash if(size >0) write() and I
> > am merely suggesting that the if statement be removed.
>
> Have you considered that it might just be writing to a FILE*, and that
> it's the stdio subsystem that's deciding it doesn't need to write
> anything at close() time because nothing was actually written?

Good point.  A quick test program shows that fwrite() doesn't support writing 
zero bytes.

In that case we have a choice between having a change in the interface (such 
as supporting the writing of "\n" for an empty setting), or just leaving such 
operations as being impossible in shell scripts.

-- 
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page




More information about the fedora-devel-list mailing list