From 05d3f673b08bc11a9c2d40cd6a33f4872cde2549 Mon Sep 17 00:00:00 2001 From: G2-Games Date: Sat, 3 Sep 2022 22:48:19 -0500 Subject: [PATCH] Fixed line removal for uninstall --- install.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index b07b420..8c495c5 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,4 @@ -#!/bin/zsh - -version='0.2' +version=0.2 bashrc="/home/$USER/.bashrc" zshrc="/home/$USER/.zshrc" originaldir=$PWD @@ -43,8 +41,12 @@ then then rm /home/$USER/.welcome/welcome.sh rmdir /home/$USER/.welcome - sed -i 's#bash /home/$USER/.welcome/welcome.sh##g' $bashrc # Try from both - sed -i 's#zsh /home/$USER/.welcome/welcome.sh##g' $zshrc + line=$(grep -n 'bash /home/$USER/.welcome/welcome.sh' $bashrc) + line=${line%:*} + sed -i "${line}d" $bashrc + line=$(grep -n 'zsh /home/$USER/.welcome/welcome.sh' $zshrc) + line=${line%:*} + sed -i "${line}d" $zshrc tput rc el ed echo -e "\e[36mUninstalled! \e[0m" else @@ -53,5 +55,5 @@ then fi fi else - echo "This script can only be installed in bash or zsh." + printf "\e[31;5mERROR:\e[0m \e[31;3mThis script can only be installed in bash or zsh.\e[0m\n" fi