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