note
gaal
If you only have one normal exit point to your script, have it set a flag. Check this flag in your END block, and only write to the file when it is not set.
<p>If you have more than one normal exit point to your script, well, refactor a bit. :-)
<p>PS: note that the way you're opening your file, its contents will be overwritten every time, rather than appended to. Use ">>" if you prefer the other way.
700920
700926