trap to cleanup temp file on exit
This commit is contained in:
parent
7679ea3f61
commit
ac8bcc821b
|
@ -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}
|
||||
|
|
Loading…
Reference in New Issue