🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1050

Re: How to do <cmd> file | hold file (now cp)

#1050
From: Leslie Mikesell
Date: Wed, 12 Sep 1990 19:33
41 lines
2489 bytes
In article <19911:Sep1113:47:2290@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:

>No. That is not what cp does. cp copies a file with one name into a new
>file with a different name.

Not my cp.  Mine recognizes existing files.

>> The other
>> semantics associated with a file (i.e the contents of the inode) are
>> associated with the name, which is not being changed.

>What are you talking about? The filename has absolutely nothing to do
>with the contents of the inode; it's just a way of finding the inode.

Exactly: you find the inode and it's associated information by its
name.  Using an existing name means that you want to refer to the
inode associated with that name.

>Huh? ln is the program that associates a name with a different inode.

No, ln associates a different name with a particular inode that can
also be found with an existing name.

>Let me put it this way: If you had two programs, cp (copy) and rp
>(replace), the first with unlink/create and the second with over-write,
>which would you end up using almost all the time? The only time the
>semantics of rp would be proper would be when you really were replacing
>the old version of a file with a new version---but there's a program
>called ``install'' that was designed to do this job.

I would always use the over-writing version, because if I have a file
of a certain name, then I have already set the ownership, permissions,
and hard links the way they should be for a file of that name.  When
I cp something to that name, I just want to replace the contents.
For a more philosophical approach: I like commands to be as consistant
as possible under all conditions.  If you cp a file to a device or
FIFO, would you like to have the special file unlinked and the name
re-used for something else?

Les Mikesell
  les@chinet.chi.il.us
Technical Details
Message-ID: <1990Sep12.193357.17999@chinet.chi.il.us>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!julius.cs.uiuc.edu!apple!olivea!orc!inews!iwarp.intel.com!gargoyle!chinet!les
References: <15472:Sep1015:27:3190@kramden.acf.nyu.edu> <1990Sep11.040043.14727@chinet.chi.il.us> <19911:Sep1113:47:2290@kramden.acf.nyu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!julius.cs.uiuc.edu!apple!olivea!orc!inews!iwarp.intel.com!gargoyle!chinet!les
From: les@chinet.chi.il.us (Leslie Mikesell)
Newsgroups: comp.unix.shell
Subject: Re: How to do <cmd> file | hold file (now cp)
Message-ID: <1990Sep12.193357.17999@chinet.chi.il.us>
Date: 12 Sep 90 19:33:57 GMT
References: <15472:Sep1015:27:3190@kramden.acf.nyu.edu> <1990Sep11.040043.14727@chinet.chi.il.us> <19911:Sep1113:47:2290@kramden.acf.nyu.edu>
Organization: Chinet - Chicago Public Access UNIX
Lines: 41