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:
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
Block a user