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

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Thu Sep 13 16:38:37 AEST 1990


In article <13611 at hydra.gatech.EDU> gt0178a at prism.gatech.EDU (BURNS,JIM) writes:
: in article <19911:Sep1113:47:2290 at kramden.acf.nyu.edu>, brnstnd at kramden.acf.nyu.edu (Dan Bernstein) says:
: > In article <1990Sep11.040043.14727 at chinet.chi.il.us> les at chinet.chi.il.us (Leslie Mikesell) writes:
: >> In article <15472:Sep1015:27:3190 at kramden.acf.nyu.edu> brnstnd at 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 following script demonstrates that neither cp or > change the inode of
: the original file s (& therefore, both change the *contents* of the file -
: this is std behavior on 3 systems):

We're all aware of that. I'm arguing that the behavior for cp is
unintuitive.

---Dan



More information about the Comp.unix.shell mailing list