How to do <cmd> file | hold file
Neil Rickert
rickert at mp.cs.niu.edu
Mon Sep 10 00:00:57 AEST 1990
In article <8029:Sep903:04:5390 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>(I think cp foo bar should work like ( rm -f bar; cat > bar ) < foo, so
>that other links to bar won't be affected; but POSIX 1003.2 apparently
>disagrees and has cp foo bar work like cat < foo > bar. Oh, well.)
>
Please don't ever implement 'cp' in the way you suggest. Doing so would
change file ownership, group, and permissions, not to mention that it would
fail if the file is in directory for which you do not have write permission.
It also messes up multiple links and symbolic links to the file.
--
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
Neil W. Rickert, Computer Science <rickert at cs.niu.edu>
Northern Illinois Univ.
DeKalb, IL 60115. +1-815-753-6940
More information about the Comp.unix.shell
mailing list