Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!ucsd!sdcc6!sdcc13!ghong From: ghong@sdcc13.ucsd.edu (Gary) Newsgroups: comp.unix.xenix.sco Subject: Re: emptying a file and keeping its ownership Message-ID: <15310@sdcc6.ucsd.edu> Date: 8 Jan 91 19:34:03 GMT References: <4597@sactoh0.SAC.CA.US> <1991Jan8.124644.6514@bluemtn> Sender: news@sdcc6.ucsd.edu Organization: University of California, San Diego Lines: 40 Nntp-Posting-Host: sdcc13.ucsd.edu In article <1991Jan8.124644.6514@bluemtn> perry@bluemtn (Perry Minyard (3MTA3)) writes: >S >Reply-To: perry@bluemtn.UUCP (Perry Minyard (3MTA3)) >Followup-To: >Distribution: na >Organization: blue mountain software >Keywords: > >In article mjohnsto@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. 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 > ^D Again, is the name of the file. If your NOCLOBBER variable is set, you probably want to use: % cat >! ^D I'm not sure, but you may/may not need a space before the bang ("!"). Gary Hong ghong@ucsd.edu