This is driving me crazy. echo $PATH keeps returning a path - /home/fede/.local/lilypond/lilypond-2.24.1/ - which exists but it’s no longer present in the PATH defined in .bash_profile. You can see also repeated paths here:
$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
# Percorso ai binari ufficiali di LilyPond
export PATH=$HOME/.local/lilypond/lilypond-2.24.3/bin:$PATH
I found many similar issues on the Internet, for example this one, and the general recommendation is running hash -r to clear the bash cache. This is not working though.
Check your ~/.bashrc and files in the /etc/profile.d/ directory to see if your PATH is set there. Your /etc/profile and /etc/bashrc are also sourced when you log in and you can check those if you made any changes there.
Bash caches the full path to a command, but I don’t think it caches environment variables between sessions. It has to be set somewhere, whether by bash itself or inherited from somewhere. There are some suggestions in this thread:
I was sure I restarted the system before checking. But now I think I used source .bash_profile, which seems to produce strange results: path duplications; paths still present even if removed between a source command and another.