2
0
mirror of https://github.com/alexanderepstein/Bash-Snippets synced 2018-11-08 02:59:35 +01:00
Bash-Snippets/uninstall.sh
Alex Epstein b4533d163f Making it easier to add new tools to installer and uninstaller
Just add the title of the tool to the array tools in install.sh and uninstall.sh
2017-07-07 17:06:51 -04:00

26 lines
697 B
Bash
Executable File

#!/bin/bash
# Author: Alexander Epstein https://github.com/alexanderepstein
declare -a tools=(currency stocks weather crypt movies taste short geo cheat ytview cloudup qrify)
askUninstall()
{
if [[ -f /usr/local/bin/$1 ]];then
echo -n "Do you wish to uninstall $1 [Y/n]: "
read -r answer
if [[ "$answer" == "Y" || "$answer" == "y" ]] ;then
cd $1 || return 1
echo -n "Removing $1: "
rm -f /usr/local/bin/$1 > /dev/null 2>&1 || { echo "Failed" ; echo "Error removing file, try running uninstall script as sudo"; exit 1; }
echo "Success"
cd .. || return 1
fi
unset answer
fi
}
for tool in "${tools[@]}"
do
askUninstall $tool || exit 1
done