Skip to content

Commit 9228327

Browse files
author
nnyyxxxx
committed
Fix backup logic
1 parent 55c6db1 commit 9228327

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tabs/applications-setup/mybash-setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ installZoxide() {
8888

8989
linkConfig() {
9090
OLD_BASHRC="$HOME/.bashrc"
91-
if [ -e "$OLD_BASHRC" ]; then
91+
if [ -e "$OLD_BASHRC" ] && [ ! -e "$HOME/.bashrc.bak" ]; then
9292
printf "%b\n" "${YELLOW}Moving old bash config file to $HOME/.bashrc.bak${RC}"
9393
if ! mv "$OLD_BASHRC" "$HOME/.bashrc.bak"; then
9494
printf "%b\n" "${RED}Can't move the old bash config file!${RC}"
@@ -105,7 +105,7 @@ linkConfig() {
105105
printf "%b\n" "${RED}Failed to create symbolic link for starship.toml${RC}"
106106
exit 1
107107
}
108-
printf "%b\n" "${GREEN}Done!\nrestart your shell to see the changes.${RC}"
108+
printf "%b\n" "${GREEN}Done! restart your shell to see the changes.${RC}"
109109
}
110110

111111
checkEnv

tabs/applications-setup/neovim-setup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ setupNeovim() {
3636
}
3737

3838
backupNeovimConfig() {
39-
[ -d "$HOME/.config/nvim" ] && cp -r "$HOME/.config/nvim" "$HOME/.config/nvim-backup"
39+
if [ -d "$HOME/.config/nvim" ] && [ ! -d "$HOME/.config/nvim-backup" ]; then
40+
cp -r "$HOME/.config/nvim" "$HOME/.config/nvim-backup"
41+
fi
4042
rm -rf "$HOME/.config/nvim"
4143
}
4244

0 commit comments

Comments
 (0)