From 9b556fc33343af1e2d75bc85eb7a3e50021d2ed9 Mon Sep 17 00:00:00 2001 From: bruno Date: Wed, 26 Jul 2023 10:35:31 -0400 Subject: [PATCH] corr --- install.sh | 56 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/install.sh b/install.sh index 5388455..fb426f9 100644 --- a/install.sh +++ b/install.sh @@ -127,40 +127,48 @@ installSoftware() { fi } + + + # Fonction permettant de déterminer le shell courant setPATHCurrentShell(){ CurrentShell = $(echo $SHELL | awk -F/ '{print $NF}') info "===> Shell courant : $CurrentShell" - # si le shell est bash - if [ "$CurrentShell" == "bash" ]; then - - # Ajouter a la variable PATH le path .config/scut/ au fichier .bashrc - echo "export PATH=$PATH:~/.config/scut/" >> ~/.bashrc + # vérifier que ~/.config/scut/ est dans la variable PATH + if [[ $PATH == *~/.config/scut/* ]]; then + warn "===> ~/.config/scut/ est déjà dans la variable PATH" + else + # si le shell est bash + if [ "$CurrentShell" == "bash" ]; then + + # Ajouter a la variable PATH le path .config/scut/ au fichier .bashrc + echo "export PATH=$PATH:~/.config/scut/" >> ~/.bashrc - # si le shell est zsh - elif [ "$CurrentShell" == "zsh" ]; then + # si le shell est zsh + elif [ "$CurrentShell" == "zsh" ]; then + + # Ajouter a la variable PATH le path .config/scut/ au fichier .zshrc + echo "export PATH=$PATH:~/.config/scut/" >> ~/.zshrc - # Ajouter a la variable PATH le path .config/scut/ au fichier .zshrc - echo "export PATH=$PATH:~/.config/scut/" >> ~/.zshrc - - # si le shell est fish - elif [ "$CurrentShell" == "fish" ]; then + # si le shell est fish + elif [ "$CurrentShell" == "fish" ]; then + + # Ajouter a la variable PATH le path .config/scut/ au fichier .config/fish/config.fish + echo "set PATH $PATH ~/.config/scut/" >> ~/.config/fish/config.fish - # Ajouter a la variable PATH le path .config/scut/ au fichier .config/fish/config.fish - echo "set PATH $PATH ~/.config/scut/" >> ~/.config/fish/config.fish - - # si le shell est NuShell - elif [ "$CurrentShell" == "nu" ]; then - - # Ajouter a la variable PATH le path .config/scut/ au fichier .config/nu/config.toml - echo "path = [\"$PATH\", \"~/.config/scut/\"]" >> ~/.config/nu/config.toml + # si le shell est NuShell + elif [ "$CurrentShell" == "nu" ]; then + + # Ajouter a la variable PATH le path .config/scut/ au fichier .config/nu/config.toml + echo "path = [\"$PATH\", \"~/.config/scut/\"]" >> ~/.config/nu/config.toml - else - error "!! => Shell courant non supporté : $CurrentShell" - error "!! => Veuillez ajouter le path ~/.config/scut/ à votre variable PATH manuellement." - error "!! => les shells supportés sont : bash, zsh, fish et NuShell." + else + error "!! => Shell courant non supporté : $CurrentShell" + error "!! => Veuillez ajouter le path ~/.config/scut/ à votre variable PATH manuellement." + error "!! => les shells supportés sont : bash, zsh, fish et NuShell." + fi fi }