Bash-Snippets/uninstall.sh

36 lines
981 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# Author: Alexander Epstein https://github.com/alexanderepstein
declare -a tools=(cheat cloudup crypt cryptocurrency currency geo movies newton qrify short siteciphers stocks taste todo weather ytview)
2017-07-08 08:40:29 +02:00
all="1"
askUninstall()
{
2017-07-26 20:18:17 +02:00
if [[ -f /usr/local/bin/$1 ]]; then
echo -n "Do you wish to uninstall $1 [Y/n]: "
read -r answer
2017-07-26 20:18:17 +02:00
if [[ "$answer" == [Yy] ]]; 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
2017-07-08 08:40:29 +02:00
else
all="0"
fi
unset answer
fi
}
2017-07-08 08:40:29 +02:00
removeManpage()
{
rm -f /usr/local/man/man1/bash-snippets.1 2>&1 || { echo "Failed" ; echo "Error removing file, try running uninstall script as sudo"; exit 1; }
}
2017-07-26 20:18:17 +02:00
for tool in "${tools[@]}"; do
askUninstall $tool || exit 1
done
2017-07-08 08:40:29 +02:00
2017-07-26 20:18:17 +02:00
if [[ $all == "1" ]]; then
removeManpage || exit 1
fi