Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!samsung!usc!wuarchive!zaphod.mps.ohio-state.edu!rpi!uupsi!jpradley!jpr From: jpr@jpradley.jpr.com (Jean-Pierre Radley) Newsgroups: comp.unix.xenix.sco Subject: Re: emptying a file and keeping its ownership Message-ID: <1991Jan01.173014.3236@jpradley.jpr.com> Date: 1 Jan 91 17:30:14 GMT References: <1990Dec30.220722.29050@jarvis.csri.toronto.edu> <1990Dec31.214030.7816@athena.mit.edu> <1991Jan1.040621.27634@NCoast.ORG> Reply-To: jpr@jpradley.UUCP (Jean-Pierre Radley) Distribution: na Organization: NYC Public Unix Lines: 26 In article <1991Jan1.040621.27634@NCoast.ORG> allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) writes: >As quoted from <1990Dec31.214030.7816@athena.mit.edu> by jik@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. I find that in my csh, the following works: % : > file That initial colon does the trick. What mechanism is operating here? Jean-Pierre Radley NYC Public Unix jpr@jpr.com CIS: 72160,1341