emptying a file and keeping its ownership

Chuan Chee ckchee at dgp.toronto.edu
Mon Dec 31 14:07:23 AEST 1990


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

Thanks in advance.

...Chuan Chee
   ckchee at dgp.utoronto.ca
   ckchee at dgp.toronto.edu (internet)
   ckchee at dgp.utoronto    (bitnet)



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