emptying a file and keeping its ownership

Brandon S. Allbery KB8JRR allbery at NCoast.ORG
Tue Jan 1 15:06:21 AEST 1991


As quoted from <1990Dec31.214030.7816 at athena.mit.edu> by jik at athena.mit.edu (Jonathan I. Kamens):
+---------------
|   Several people have suggested using
|     > $FILE
| to truncate a file while retaining its old permissions.  This will work under
| sh or ksh or bash or other shells that allow null commands for redirection. 
| Unfortunately, csh and tcsh do not allow such null commands :-(.  Therefore,
+---------------

	% ls -s file
	4 file
	% echo > file
	% ls -s file
	0 file
	% _

Not that I like csh's echo behavior in this case, but it does get around the
"null command" problem.

++Brandon
-- 
Me: Brandon S. Allbery			    VHF/UHF: KB8JRR on 220, 2m, 440
Internet: allbery at NCoast.ORG		    Packet: KB8JRR @ WA8BXN
America OnLine: KB8JRR			    AMPR: KB8JRR.AmPR.ORG [44.70.4.88]
uunet!usenet.ins.cwru.edu!ncoast!allbery    Delphi: ALLBERY



More information about the Comp.unix.xenix.sco mailing list