mirror of
https://github.com/captainark/github2email.git
synced 2024-11-22 00:31:42 +01:00
trap to cleanup temp file on exit
This commit is contained in:
parent
7679ea3f61
commit
ac8bcc821b
@ -1,5 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Function to clean temporary file
|
||||||
|
ExitCleanup() {
|
||||||
|
if [[ ! -z ${TempFile} ]]; then
|
||||||
|
[[ -f ${TempFile} ]] && rm ${TempFile}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
trap ExitCleanup EXIT
|
||||||
|
|
||||||
# shellcheck source=config
|
# shellcheck source=config
|
||||||
source "$(dirname $0)/config"
|
source "$(dirname $0)/config"
|
||||||
|
|
||||||
@ -55,5 +64,3 @@ for Projects in ${AddedProjects}; do
|
|||||||
echo "Project ${ProjectToRemove} has been removed from rss2email configuration !"
|
echo "Project ${ProjectToRemove} has been removed from rss2email configuration !"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ -f ${TempFile} ]] && rm ${TempFile}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user