proper cleanup trap
This commit is contained in:
parent
48e6a13ba9
commit
4b18880089
10
42git.sh
10
42git.sh
@ -12,7 +12,13 @@ git_repo="git@git.dafu.dev:3022/dafu/fg_backup"
|
||||
|
||||
# temp dir
|
||||
temp_dir=$(mktemp -d)
|
||||
cd "$temp_dir"
|
||||
cd "$temp_dir" || exit
|
||||
|
||||
cleanup() {
|
||||
rm -r "$temp_dir"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
# git
|
||||
echo "cloning from $git_repo"
|
||||
@ -57,5 +63,3 @@ else
|
||||
echo "no changes found. aborting"
|
||||
fi
|
||||
|
||||
# cleanup
|
||||
rm -r "$temp_dir"
|
||||
|
Loading…
Reference in New Issue
Block a user