diff --git a/install.sh b/install.sh index a0b66ad..5388455 100644 --- a/install.sh +++ b/install.sh @@ -127,6 +127,44 @@ 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 + + # 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 + + # 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 + + # 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." + fi + +} + # Fonction de nettoyage du répertoire courant cleanupCurrentDir(){ # Vérifier et supprimer le ou les fichier scut-latest.zip* du répertoire courant @@ -164,6 +202,12 @@ info "\n=> INSTALLATION du programme :" lineSpacer installSoftware +# add .config/scut to PATH +# ==--==--==--==--==--==--== +info "\n=> SOUCE var PATH avec ./config/scut :" +lineSpacer +setPATHCurrentShell + # cleanup current directory # ==--==--==--==--==--==--== info "\n=> CLEANUP de l'installation :"