Article View: comp.unix.shell
Article #1042Re: How to do <cmd> file | hold file (now cp)
From: Dan Bernstein
Date: Tue, 11 Sep 1990 13:47
Date: Tue, 11 Sep 1990 13:47
38 lines
2561 bytes
2561 bytes
In article <1990Sep11.040043.14727@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes: > In article <15472:Sep1015:27:3190@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: > >Of course the editor should use write-over, as it's conceptually > >modifying the *same* file. cp is putting a *different* file into the > >name previously used for the original. > Ah, but cp should only replace the *contents of the file*. No. That is not what cp does. cp copies a file with one name into a new file with a different name. The shell's > is what you use to replace the contents of a file. > 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. Have you forgotten about hard links? > A program that associates the same name with a different inode or different > inode attributes might be a useful thing, but it shouldn't be called cp > (at least not in something that claims to be unix). Huh? ln is the program that associates a name with a different inode. cp shouldn't be described this way at all; it associates (a copy of) a file's contents with a new name. If there's already an association between that new name and a different file, then cp should either fail or sever the original association. It most certainly should not preserve the original association when it's talking about an entirely new file. 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. ---Dan
Technical Details
Message-ID:
<19911:Sep1113:47:2290@kramden.acf.nyu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!wuarchive!husc6!cmcl2!kramden.acf.nyu.edu!brnstndReferences:
<HKS5I=B@xds1.ferranti.com> <15472:Sep1015:27:3190@kramden.acf.nyu.edu> <1990Sep11.040043.14727@chinet.chi.il.us>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!wuarchive!husc6!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.unix.shell Subject: Re: How to do <cmd> file | hold file (now cp) Message-ID: <19911:Sep1113:47:2290@kramden.acf.nyu.edu> Date: 11 Sep 90 13:47:22 GMT References: <HKS5I=B@xds1.ferranti.com> <15472:Sep1015:27:3190@kramden.acf.nyu.edu> <1990Sep11.040043.14727@chinet.chi.il.us> Organization: IR Lines: 38