Listmates,
I set up a simple trap to gzip any open files on scripts interrupt or exit:
cleanup () {
echo -e "\n\tExecuting cleanup from trap\n"
[[ -e $NEWFILE ]] && gzip --force --quiet $NEWFILE
[[ -e $XMLFILE ]] && gzip --force --quiet $XMLFILE
}
trap cleanup SIGINT SIGTERM EXIT
rest of script....
trap works correctly, but when it is called, it seems to be inserting 45
blank-lines after the original command line causing the terminal to scroll-up.
Looks odd:
08:33 alchemy:~/linux/scripts/parse> sh xmlparse test.xml.gz