From 9024eefdcf7d434c09c83d2014455d152cf25e9a Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Mon, 24 Mar 2025 17:11:52 +0900 Subject: [PATCH] adjusted zsh.sh so it will work even on a non-posix compliant shell like fish --- install-scripts/zsh.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/install-scripts/zsh.sh b/install-scripts/zsh.sh index 36ce913..3660912 100755 --- a/install-scripts/zsh.sh +++ b/install-scripts/zsh.sh @@ -76,18 +76,20 @@ if command -v zsh >/dev/null; then cp -r 'assets/.zprofile' ~/ # Check if the current shell is zsh - if [[ "$SHELL" != *"zsh"* ]]; then + current_shell=$(basename "$SHELL") + if [ "$current_shell" != "zsh" ]; then printf "${NOTE} Changing default shell to ${MAGENTA}zsh${RESET}..." printf "\n%.0s" {1..2} - while ! chsh -s $(which zsh); do + # Loop to ensure the chsh command succeeds + while ! chsh -s "$(command -v 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" else - echo "${NOTE}Your shell is already set to ${MAGENTA}zsh${RESET}." + echo "${NOTE} Your shell is already set to ${MAGENTA}zsh${RESET}." fi fi