emptying a file and keeping its ownership

Lance Speelmon -- UCS speelmo at bronze.ucs.indiana.edu
Fri Jan 11 05:26:14 AEST 1991


I think the easiest way to do this is:
cp /dev/null <FILE>

Lance

In article <1990Dec30.220722.29050 at jarvis.csri.toronto.edu> ckchee at dgp.toronto.edu (Chuan Chee) writes:
>I have SCO Xenix 2.2.3.  What's the easiest way to "empty" a file
>while keeping its ownership (owner,group) and access permissions the
>same?  Actually I only care about permissions (rw-rw-rw).
>I would like this done in Bourne shell (or possibly CSH).
>One other thing, this shell script is run under root.
>
>Here's the way I currently do it:
>  rm -f $FILE
>  touch $FILE
>  chmod +w $FILE
>  chown $OWNER $FILE
>  chgrp $GRP $FILE
>
-- 
==============================================================================
| Lance Speelmon                      |  University Computing Services       | 
| speelmo at bronze.ucs.indiana.edu      |  Network Operations Center           |
==============================================================================



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