Skip to content

Duplicated ~/.local/bin in $PATH

Due to the way bash works, you have /etc/profile being executed twice:

  • Once when your desktop environment spins up
  • Second when you start a new login shell

On the second run, it also inherits the environment from your desktop environment, meaning you already have an entry in the $PATH, so the new entry is added unconditionally, duplicating the value.

For home-local-bin.sh I propose this change:

case ":${PATH}:" in
  *:"$HOME/.local/bin":*) ;;
  *) export PATH="$HOME/.local/bin:$PATH" ;;
esac

NOTE: The value needs to be prepended, not appended.

Same thing happens in jre.sh in the same directory, but that is part of java-runtime-common

Edited by Codruț Constantin Gușoi