Re: leading null characters produced in script...



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
.



Relevant Pages

  • Re: JMS: Year-end update?
    ... >> Any chance of an update on the usual list of projects (TV, comics, plays, ... Any convention ... >Next week three jms comics hit the stands, the third (and best of the ... >script, ...
    (rec.arts.sf.tv.babylon5.moderated)
  • Re: JMS: Year-end update?
    ... Any convention ... Next week three jms comics hit the stands, the third (and best of the ... In addition to the other books I'm doing for Marvel, ... script, ...
    (rec.arts.sf.tv.babylon5.moderated)
  • Re: Help with files and spaces with shell script
    ... you should never name unexported variables with UPPER CASE names. ... By following that convention your script variable ... not need to be the person exporting the variable. ...
    (Fedora)
  • Re: Do you add file type suffix to your script?
    ... So take account of the object of your scripts, if your own tools, just name it anything you like. ... If, however, they are going to used by others in your team, just abide by the convention of it. ... wonder whether should I add the file type as the suffix to the script. ...
    (comp.unix.shell)
  • Sonicwall SOHO Content Blocking Script Injection, LogFile Denial of Service
    ... Sonicwall SOHO Content Blocking Script Injection and Logfile DoS ...
    (Vuln-Dev)