Using bash's trap to do the cleaning on exit.

This commit is contained in:
Benoît S. 2016-05-19 11:33:58 +02:00
parent 8991299214
commit 3ab06aded7

View file

@ -17,6 +17,9 @@ header=$(mktemp /tmp/virustotal.XXX.tmp)
# Set to false if you want to keep the virus file.
removeVirus=true
# Cleaning on exit.
trap "rm $report $header" EXIT SIGINT
apiReturn() {
header=$1
@ -64,6 +67,4 @@ else
echo "No virus detected. Not adding a signature to Evolix database."
fi
# Cleaning
rm "$report"
exit 0