> Purely for kicks I tried editing a file with vim that was "write
> only". i.e. with mask as -w-
> 
> vim warns me that this is a "read only" file and cannot be edited.

Really? My vim does what I would expect it to do: gives a 'Permission
denied' error (well, just a message, actually, I think).

> Just curious if this is a side effect or has other implications. Why
> does vim treat "write only" files as "read only"?

It sets the 'readonly' option of the buffer to prevent you from too
easily accidentally overwriting the file. It really just means it forces
you to use a bang (!) when writing the file.

> Incidentally I don't have any use for a "write only" file.  It is just
> my curiosity that is trying to figure out if there was a use.

There are uses, but they are rare, and, to be honest, I think other
mechanisms are pretty universally preferred now. The most obvious one is
log files (or mailboxes):

cat Here is a new message >> log-file
cat Here is a new message >> mailbox-belonging-to-somebody-else

You can add messages, but you can't see anybody else's messages.

Of course, to avoid having messages from multiple users clobbered or
mixed up by two people writing at the same time, some locking mechanism
needs to be used in this application.

Ben.




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to