Re: leading null characters produced in script...
- From: "Chris F.A. Johnson" <cfajohnson@xxxxxxxxx>
- Date: Mon, 30 Oct 2006 12:55:34 -0500
On 2006-10-30, Dances With Crows wrote:
On 30 Oct 2006 08:17:01 -0800, Avalon1178 staggered into the Black Sun
and said:
I think you need 'cp /dev/null $logFile' instead of 'cat'.Nope, that does not work. Neither does 'echo "" > $logFile".
The problem is not with the log rotation script AFAICT.
logSize=$(stat -c%s $logFile);
if [ $logSize -ge 5000 ]; then
cp $logFile $logFile.arch
cat /dev/null >$logFile
The standard convention in shell scripting is to have your variables in
uppercase.
It certainly is not! Some use the convention of having _exported_
variables in upper case, but even that is far from universal.
It's kind of hard to read when you try to use Pascal/Java
conventions in a bash script.
I don't see anything hard to read.
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
.
- References:
- leading null characters produced in script...
- From: Avalon1178
- Re: leading null characters produced in script...
- From: Paul Colquhoun
- Re: leading null characters produced in script...
- From: Avalon1178
- Re: leading null characters produced in script...
- From: Dances With Crows
- leading null characters produced in script...
- Prev by Date: Re: Installed New IDE HD, Now Fedora Won't Boot from SCSI HD
- Next by Date: Re: Firefox 2 memory requirements
- Previous by thread: Re: leading null characters produced in script...
- Next by thread: Re: leading null characters produced in script...
- Index(es):
Relevant Pages
|