Fix backup logic

This commit is contained in:
nnyyxxxx 2024-09-15 08:08:18 -04:00
parent 55c6db1b12
commit 9228327f93
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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"
}