From cfab030ca20f21a0b85f04b5b93ed255f81e6d23 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Wed, 19 Feb 2025 20:23:33 +0900 Subject: [PATCH] added initial shell check first if zsh already inorder to skip changing to zsh --- install-scripts/zsh.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/install-scripts/zsh.sh b/install-scripts/zsh.sh index a3da1af..4097e6b 100755 --- a/install-scripts/zsh.sh +++ b/install-scripts/zsh.sh @@ -62,14 +62,20 @@ if command -v zsh >/dev/null; then cp -r 'assets/.zshrc' ~/ cp -r 'assets/.zprofile' ~/ - printf "${NOTE} Changing default shell to ${MAGENTA}zsh${RESET}..." - printf "\n%.0s" {1..2} - while ! chsh -s $(which zsh); do + # Check if the current shell is zsh + if [[ "$SHELL" != *"zsh"* ]]; then + printf "${NOTE} Changing default shell to ${MAGENTA}zsh${RESET}..." + printf "\n%.0s" {1..2} + + while ! chsh -s $(which zsh); do echo "${ERROR} Authentication failed. Please enter the correct password." 2>&1 | tee -a "$LOG" sleep 1 - done - printf "${INFO} Shell changed successfully to ${MAGENTA}zsh${RESET}" 2>&1 | tee -a "$LOG" + done + printf "${INFO} Shell changed successfully to ${MAGENTA}zsh${RESET}" 2>&1 | tee -a "$LOG" + else + echo "${NOTE}Your shell is already set to ${MAGENTA}zsh${RESET}." + fi fi printf "\n%.0s" {1..2}