3

I have a version of SVN on my system in /usr/bin/svn. This is too old to use with some repositories so I compiled a newer version in /home/user/built/bin/svn which works fine. I added this to my PATH so it should be run first.

Typing

which svn

produces

/home/user/built/bin/svn

however typing

svn --version

reveals that it us using the old version still. if I run

/home/user/built/bin/svn --version

then the correct version is displayed.

Since the custom version is first in my $PATH, and which lists it first why is the older version being invoked when I run svn? I thought which used your $PATH to find executables in the same fashion as the shell?

10 Rep
  • 2,217
  • 7
  • 19
  • 33
Nick
  • 617
  • 1
  • 7
  • 22
  • whereis svn svn: /usr/bin/svn /usr/bin/X11/svn /usr/share/man/man1/svn.1.gz Whereis doesn't list the custom version on the PATH. – Nick Jan 05 '11 at 16:39

3 Answers3

4

Use

type svn

to figure out (a) what it is, (b) where it is or what its definition is. Also check that PATH really contains what you think it does

echo $PATH
user562374
  • 3,817
  • 1
  • 22
  • 19
  • Thanks, that fixed it. I hadn't come across hash before. One of those things you can normally take for granted and then bites you if you don't know what is going on under the hood! :) – Nick Jan 05 '11 at 17:15
  • Oh yeah hash. The next evil thing after ldconfig and even more hideous. – user562374 Jan 05 '11 at 17:24
1

Type gives:

type svn
svn is hashed (/usr/bin/svn)

Running

hash -r 

has now fixed the problem!

Credit to the OP

Nick
  • 617
  • 1
  • 7
  • 22
10 Rep
  • 2,217
  • 7
  • 19
  • 33
0

You sure you don't have a symbolic link to svn somewhere else in your path?

Andrew T Finnell
  • 13,417
  • 3
  • 33
  • 49
  • I don't think so, typing: which svn -a only gives the two paths. Would a symbolic link show up there? /home/user/built/bin/svn /usr/bin/svn – Nick Jan 05 '11 at 16:34