1
0
mirror of https://github.com/captainark/github2email.git synced 2024-11-21 16:21:43 +01:00

trap to cleanup temp file on exit

This commit is contained in:
CaptainArk 2018-04-20 20:15:20 +02:00
parent 7679ea3f61
commit ac8bcc821b

View File

@ -1,5 +1,14 @@
#!/bin/bash
# Function to clean temporary file
ExitCleanup() {
if [[ ! -z ${TempFile} ]]; then
[[ -f ${TempFile} ]] && rm ${TempFile}
fi
}
trap ExitCleanup EXIT
# shellcheck source=config
source "$(dirname $0)/config"
@ -55,5 +64,3 @@ for Projects in ${AddedProjects}; do
echo "Project ${ProjectToRemove} has been removed from rss2email configuration !"
fi
done
[[ -f ${TempFile} ]] && rm ${TempFile}