emptying a file and keeping its ownership

Gary ghong at sdcc13.ucsd.edu
Wed Jan 9 06:34:03 AEST 1991


In article <1991Jan8.124644.6514 at bluemtn> perry at bluemtn (Perry Minyard (3MTA3)) writes:
>S
>Reply-To: perry at bluemtn.UUCP (Perry Minyard (3MTA3))
>Followup-To: 
>Distribution: na
>Organization: blue mountain software
>Keywords: 
>
>In article <MJOHNSTO.91Jan7113152 at admin8780.shearson.com> mjohnsto at admin8780.shearson.com (Mike Johnston) writes:
>>
>>Isn't it silly to spend all this time developing rediculously long solutions
>>to a simple problem when:
>>
>>
>>would suffice?
>
>No, it wouldn't.  touch will not erase a file that already exists.   touch
>only updates the time/date stamp on the file.  If the file doesn't exist,
>it will create it.    <at least this holds true for SCO XENIX>


Ok, you are right about that, but touch will give you an empty file
if file does not exists.

Here is another simple solution to emptying a file and keeping its
ownership:

% cat > <filename>
^D

Again, <filename> is the name of the file.  If your NOCLOBBER
variable is set, you probably want to use:

% cat >! <filename>
^D

I'm not sure, but you may/may not need a space before the bang ("!").

Gary Hong
ghong at ucsd.edu



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