From 9228327f93345be9d4b05598ff5f6e33c2168f35 Mon Sep 17 00:00:00 2001 From: nnyyxxxx Date: Sun, 15 Sep 2024 08:08:18 -0400 Subject: [PATCH] Fix backup logic --- tabs/applications-setup/mybash-setup.sh | 4 ++-- tabs/applications-setup/neovim-setup.sh | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tabs/applications-setup/mybash-setup.sh b/tabs/applications-setup/mybash-setup.sh index a258afc4..7bca14e2 100644 --- a/tabs/applications-setup/mybash-setup.sh +++ b/tabs/applications-setup/mybash-setup.sh @@ -88,7 +88,7 @@ installZoxide() { linkConfig() { OLD_BASHRC="$HOME/.bashrc" - if [ -e "$OLD_BASHRC" ]; then + if [ -e "$OLD_BASHRC" ] && [ ! -e "$HOME/.bashrc.bak" ]; then printf "%b\n" "${YELLOW}Moving old bash config file to $HOME/.bashrc.bak${RC}" if ! mv "$OLD_BASHRC" "$HOME/.bashrc.bak"; then printf "%b\n" "${RED}Can't move the old bash config file!${RC}" @@ -105,7 +105,7 @@ linkConfig() { printf "%b\n" "${RED}Failed to create symbolic link for starship.toml${RC}" exit 1 } - printf "%b\n" "${GREEN}Done!\nrestart your shell to see the changes.${RC}" + printf "%b\n" "${GREEN}Done! restart your shell to see the changes.${RC}" } checkEnv diff --git a/tabs/applications-setup/neovim-setup.sh b/tabs/applications-setup/neovim-setup.sh index f8788903..0d3a2578 100755 --- a/tabs/applications-setup/neovim-setup.sh +++ b/tabs/applications-setup/neovim-setup.sh @@ -36,7 +36,9 @@ setupNeovim() { } backupNeovimConfig() { - [ -d "$HOME/.config/nvim" ] && cp -r "$HOME/.config/nvim" "$HOME/.config/nvim-backup" + if [ -d "$HOME/.config/nvim" ] && [ ! -d "$HOME/.config/nvim-backup" ]; then + cp -r "$HOME/.config/nvim" "$HOME/.config/nvim-backup" + fi rm -rf "$HOME/.config/nvim" }