I have a program called f in my $PATH, I can simply execute it by typing f into a terminal. However, typing which f into that same terminal afterwards, it errors out: which: no f in (...), and it gives the full path in brackets (which indeed contains the correct path for f itself).
Using type f however I get the correct result.
Does anyone have an idea why that is the case?
Here are the answers to questions from the comments:
- f itself is a symlink to a perl script: - vwos3xz@vwososuvs012:~$ls -l $(command -v f) lrwxrwxrwx 1 root root 42 2. Aug 2012 /tef/tegf/06_CAE_System/064_soft/PERL_SCRIPTE/bin/f -> ../CRASH_SCRIPTE/FEMSTARTER/fem-starter.pl- In fact, fem_starter.pl itself is a symlink to fem_starter-1.77.pl in the same directory 
- I'm reasonably sure there's no typo in the path because I can simply type - fin a terminal and have it run (also, type and command -v work).
- I set the path in .bashrc, but .bash_profile exists and just sources .bashrc. Also, I have BASH_ENV set to my .bashrc. 
- type freturns- f ist /tef/tegf/06_CAE_System/064_soft/PERL_SCRIPTE/bin/f, and- command -vreturns- /tef/tegf/06_CAE_System/064_soft/PERL_SCRIPTE/bin/f. Also,- type -a freturns the same as- type f.
- "Have you opened a new window?"... do you mean a new terminal? I did, but that did not make a difference. I used both xterm and konsole, and I did start each from the window manager as well as from another xterm. Everytime, the $PATH was correctly set, but which did not work as expected. 
 
    