From c59eb36be79d1d212a3e216bd0d6460d332c24ea Mon Sep 17 00:00:00 2001 From: Craig Everett Date: Fri, 4 Jul 2025 08:45:58 +0900 Subject: [PATCH] Fix path settings --- unix/install | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/unix/install b/unix/install index 7a637e7..7c2f91d 100755 --- a/unix/install +++ b/unix/install @@ -35,22 +35,27 @@ if [[ ":$PATH:" == *":$bin:"* ]] export PATH="$bin:$PATH" fi -for rc in "$HOME/.profile" "$HOME/.bashrc" "$HOME/.bash_profile" - do - if [ -f "$rc" ] - then - if grep -q "PATH=\"\$HOME/bin:\$PATH\"" "$rc" - then - echo "Path adjustment found in $rc." - else - echo "Path adjustment not found in $rc. Adding it." - echo "\n" >> "$rc" - echo "export PATH=\"\$HOME/bin:\$PATH\"" >> "$rc" +if [[ ":$PATH:" == *":$HOME/bin:"* ]] +then + echo "'$HOME/bin' is in '$PATH' -- skipping" +else + export PATH="$HOME/bin:$PATH" +fi + +for rc in ~/.bashrc ~/.bash_profile ~/.profile ~/.zshrc ~/.zprofile ~/.zshenv +do + if [[ -f "$rc" ]] + then + if ! grep -q "export PATH=.*[:=]$HOME/bin[:$]" "$rc" + then + # This actually fixes the stupid newline thing + echo -e "\n"'export PATH="$HOME/bin:$PATH"' >> "$rc" fi - else - echo "No $rc is present. Skipping." + else + touch "$rc" + echo -e 'export PATH="$HOME/bin:$PATH"' >> "$rc" fi - done +done cp -r zomp "$zomp_dir" cp unix/zx "$zomp_dir"