Add cleanup script

main
Alfredo Palhares 2019-05-13 16:00:41 +01:00
parent 0cfc842d09
commit 4a3336e4f5
1 changed files with 36 additions and 0 deletions

36
cleanup.sh 100755
View File

@ -0,0 +1,36 @@
#!/bin/sh
# Prompts for confirmation, returns 1 if Yes
#
# Usage: getConfirmation "Question message"
# You can get anwser value on retcode
# if [[ $? == "1"]]; then
# echo "You choose yes"
# fi
function getConfirmation {
value=0
while true; do
read -p "${1} [Y/n]" yn
case $yn in
[Yy]* ) return 0 ;;
[Nn]* ) return 1 ;;
* ) return 0 ;;
esac
done
}
echo "This script will cleanup all workfiles"
getConfirmation "Do you want to proccess"
if [[ $1 == "0" ]]; then
echo "Aborting"
exit 1
fi
rm -r src/
rm -r pkg/
rm v*.zip
rm *tar.xz
exit 0