emptying a file and keeping its ownership
Jean-Pierre Radley
jpr at jpradley.jpr.com
Wed Jan 2 04:30:14 AEST 1991
In article <1991Jan1.040621.27634 at NCoast.ORG> allbery at ncoast.ORG (Brandon S. Allbery KB8JRR) writes:
>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.
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 at jpr.com CIS: 72160,1341
More information about the Comp.unix.xenix.sco
mailing list