Using echo effectively creates a "new" file with new permissions.
My preference is to use "tail" to tail the file over itself.
I.E.
#tail oldfile > oldfile
This preserves all existing permissions and ownerships.
-JMS
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Craig Westerman
Sent: Monday, July 09, 2001 11:27 PM
To: Mandrake Newbie; [EMAIL PROTECTED]
Subject: RE: [newbie] deleting contents of a file
Dan,
Many people suggested removing the file and then recreating a new empty
file. While not difficult, that does take a little more time. Your
method is much simpler and very quick. I just tried it on a log file and
it works great.
Can anyone give me a reason why this method might cause problems?
Thanks
Craig ><>
[EMAIL PROTECTED]
Craig--
On Monday 09 July 2001 01:20 am, Craig Westerman wrote:
> Is there a linux command that will remove the contents of a file, but
leave
> the file name?
Echo an empty string into it:
$ echo '' > filename.txt
That '' is a pair of single-quotes, incidentally. It's sort of hard to
see that in some fonts...
--
Dan Ray
Director Custom Applications
Triangle Research, Inc.
http://www.triangleresearch.com