From 9000e673cd5d6904916d22b04978dc996385df9b Mon Sep 17 00:00:00 2001 From: xscriptorcode Date: Wed, 17 Sep 2025 21:21:26 +0200 Subject: [PATCH] fix(uninstall): keep ~/.zshrc if no backup exists --- tools/uninstall.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/uninstall.sh b/tools/uninstall.sh index 6e3df7aca..198b3a785 100644 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -22,9 +22,14 @@ if [ -d ~/.oh-my-zsh ]; then fi if [ -e ~/.zshrc ]; then - ZSHRC_SAVE=~/.zshrc.omz-uninstalled-$(date +%Y-%m-%d_%H-%M-%S) - echo "Found ~/.zshrc -- Renaming to ${ZSHRC_SAVE}" - mv ~/.zshrc "${ZSHRC_SAVE}" + ZSHRC_ORIG=~/.zshrc.pre-oh-my-zsh + if [ -e "$ZSHRC_ORIG" ]; then + ZSHRC_SAVE=~/.zshrc.omz-uninstalled-$(date +%Y-%m-%d_%H-%M-%S) + echo "Found ~/.zshrc -- Renaming to ${ZSHRC_SAVE}" + mv ~/.zshrc "${ZSHRC_SAVE}" + else + echo "Found ~/.zshrc but no backup config detected -- leaving it untouched" + fi fi echo "Looking for original zsh config..."