2017-07-21 06:16:52 +02:00
#!/usr/bin/env bash
2017-06-27 01:57:39 +02:00
# Author: Alexander Epstein https://github.com/alexanderepstein
2018-02-24 05:38:10 +01:00
declare -a tools = ( bash-snippets cheat cloudup crypt cryptocurrency currency geo lyrics meme movies newton pwned qrify short siteciphers stocks taste todo transfer weather ytview)
2017-07-08 08:40:29 +02:00
all = "1"
2017-06-28 03:47:23 +02:00
2017-07-07 02:45:32 +02:00
askUninstall( )
{
2017-10-03 03:33:30 +02:00
if [ [ -f /usr/local/bin/$1 ] ] ; then
2017-07-07 02:45:32 +02:00
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
2017-07-07 23:06:51 +02:00
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"
2017-07-08 08:40:29 +02:00
else
all = "0"
2017-07-07 02:45:32 +02:00
fi
unset answer
fi
}
2017-08-02 19:25:34 +02:00
removeTool( )
{
2017-10-03 03:33:30 +02:00
if [ [ -f /usr/local/bin/$1 ] ] ; then
2017-08-02 19:25:34 +02:00
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"
fi
}
2017-07-08 08:40:29 +02:00
removeManpage( )
{
2017-08-02 19:25:34 +02:00
if [ -f "/usr/local/man/man1/bash-snippets.1" ] ; then rm -f "usr/local/man/man1/bash-snippets.1" || { echo "Error removing manpage, try running uninstall script as sudo" ; exit 1; } ; fi
if [ -f "/usr/local/share/man/man1/bash-snippets.1" ] ; then rm -f "/usr/local/share/man/man1/bash-snippets.1" || { echo "Error removing manpage, try running uninstall script as sudo" ; exit 1; } ; fi
2017-07-08 08:40:29 +02:00
}
2017-07-07 02:45:32 +02:00
2017-10-03 03:33:30 +02:00
if [ [ $1 != "all" ] ] ; then
2017-08-02 19:25:34 +02:00
for tool in " ${ tools [@] } " ; do
askUninstall $tool || exit 1
done
else
for tool in " ${ tools [@] } " ; do
removeTool $tool || exit 1
done
fi
2017-07-08 08:40:29 +02:00
2017-07-26 20:18:17 +02:00
if [ [ $all = = "1" ] ] ; then
removeManpage || exit 1
fi