Craig--

> 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?

Well, it's just been pointed out that it doesn't actually EMPTY the file per 
se. It actually creates a one-byte file. I believe that the 'echo' command 
prints the string argument given it, plus a newline on the end. That newline 
gets into the new file, so you actually have a file that isn't empty, but 
contains a single newline character.

As long as you don't actually need this file to be totally emptied to zero 
bytes, and don't mind a blank line at the top of the file, this should work 
fine. I haven't seen the permissions issue that Jose mentions at all, in all 
my fooling with this the permissions are preserved. So maybe he's seeing 
something we're not.


-- 
Dan Ray
Director Custom Applications
Triangle Research, Inc.
http://www.triangleresearch.com

Reply via email to