mirror of
https://github.com/alexanderepstein/Bash-Snippets
synced 2018-11-08 02:59:35 +01:00
Getting rid of cd's in uninstall and added uninstall all
This commit is contained in:
parent
9ad66a6ab9
commit
d39e550082
2 changed files with 26 additions and 7 deletions
|
@ -362,6 +362,11 @@ brew uninstall bash-snippets
|
|||
./uninstall.sh
|
||||
```
|
||||
|
||||
#### To uninstall all installed bash-snippets
|
||||
```bash
|
||||
./uninstall.sh all
|
||||
```
|
||||
|
||||
## Donate
|
||||
If this project helped you in any way and you feel like buying a broke college kid a cup of coffee
|
||||
|
||||
|
|
26
uninstall.sh
26
uninstall.sh
|
@ -9,11 +9,9 @@ askUninstall()
|
|||
echo -n "Do you wish to uninstall $1 [Y/n]: "
|
||||
read -r answer
|
||||
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
|
||||
else
|
||||
all="0"
|
||||
fi
|
||||
|
@ -21,14 +19,30 @@ askUninstall()
|
|||
fi
|
||||
}
|
||||
|
||||
removeManpage()
|
||||
removeTool()
|
||||
{
|
||||
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; }
|
||||
if [[ -f /usr/local/bin/$1 ]]; then
|
||||
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
|
||||
}
|
||||
|
||||
for tool in "${tools[@]}"; do
|
||||
removeManpage()
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
if [[ $1 != "all" ]];then
|
||||
for tool in "${tools[@]}"; do
|
||||
askUninstall $tool || exit 1
|
||||
done
|
||||
done
|
||||
else
|
||||
for tool in "${tools[@]}"; do
|
||||
removeTool $tool || exit 1
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $all == "1" ]]; then
|
||||
removeManpage || exit 1
|
||||
|
|
Loading…
Reference in a new issue