uninstall: `shellcheck` && `shfmt`

pull/1904/head
John D Pell 2021-10-09 21:54:56 -07:00
parent 6684422ff7
commit 0b74fcfadf
2 changed files with 20 additions and 20 deletions

View File

@ -27,6 +27,7 @@ bash_it.sh
clean_files.txt
install.sh
lint_clean_files.sh
uninstall.sh
# aliases
#

View File

@ -1,31 +1,30 @@
#!/usr/bin/env bash
if [ -z "$BASH_IT" ];
then
BASH_IT="$HOME/.bash_it"
fi
: "${BASH_IT:=$HOME/.bash_it}"
case $OSTYPE in
darwin*)
CONFIG_FILE=.bash_profile
;;
*)
CONFIG_FILE=.bashrc
;;
darwin*)
CONFIG_FILE=.bash_profile
;;
*)
CONFIG_FILE=.bashrc
;;
esac
BACKUP_FILE=$CONFIG_FILE.bak
if [ ! -e "$HOME/$BACKUP_FILE" ]; then
echo -e "\033[0;33mBackup file $HOME/$BACKUP_FILE not found.\033[0m" >&2
if [[ ! -e "$HOME/$BACKUP_FILE" ]]; then
echo -e "\033[0;33mBackup file $HOME/$BACKUP_FILE not found.\033[0m" >&2
test -w "$HOME/$CONFIG_FILE" &&
mv "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.uninstall" &&
echo -e "\033[0;32mMoved your $HOME/$CONFIG_FILE to $HOME/$CONFIG_FILE.uninstall.\033[0m"
else
test -w "$HOME/$BACKUP_FILE" &&
cp -a "$HOME/$BACKUP_FILE" "$HOME/$CONFIG_FILE" &&
rm "$HOME/$BACKUP_FILE" &&
echo -e "\033[0;32mYour original $CONFIG_FILE has been restored.\033[0m"
if [[ -w "$HOME/$CONFIG_FILE" ]]; then
if mv "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.uninstall"; then
echo -e "\033[0;32mMoved your $HOME/$CONFIG_FILE to $HOME/$CONFIG_FILE.uninstall.\033[0m"
fi
fi
elif [[ -w "$HOME/$BACKUP_FILE" ]]; then
if cp -a "$HOME/$BACKUP_FILE" "$HOME/$CONFIG_FILE"; then
rm "$HOME/$BACKUP_FILE"
echo -e "\033[0;32mYour original $CONFIG_FILE has been restored.\033[0m"
fi
fi
echo ""