Fix path settings

This commit is contained in:
Craig Everett 2025-07-04 08:45:58 +09:00
parent bfa1c4002b
commit c59eb36be7

View File

@ -35,22 +35,27 @@ if [[ ":$PATH:" == *":$bin:"* ]]
export PATH="$bin:$PATH" export PATH="$bin:$PATH"
fi fi
for rc in "$HOME/.profile" "$HOME/.bashrc" "$HOME/.bash_profile" if [[ ":$PATH:" == *":$HOME/bin:"* ]]
do then
if [ -f "$rc" ] 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 then
if grep -q "PATH=\"\$HOME/bin:\$PATH\"" "$rc" if ! grep -q "export PATH=.*[:=]$HOME/bin[:$]" "$rc"
then then
echo "Path adjustment found in $rc." # This actually fixes the stupid newline thing
else echo -e "\n"'export PATH="$HOME/bin:$PATH"' >> "$rc"
echo "Path adjustment not found in $rc. Adding it."
echo "\n" >> "$rc"
echo "export PATH=\"\$HOME/bin:\$PATH\"" >> "$rc"
fi fi
else else
echo "No $rc is present. Skipping." touch "$rc"
echo -e 'export PATH="$HOME/bin:$PATH"' >> "$rc"
fi fi
done done
cp -r zomp "$zomp_dir" cp -r zomp "$zomp_dir"
cp unix/zx "$zomp_dir" cp unix/zx "$zomp_dir"