Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two copies of svn on my machine.

  1. /usr/local/bin/svn

  2. /opt/subversion/bin

When I run which svn it states the first is running how can I switch it to the second?

share|improve this question
Igniacio's answer will work, but I have to ask - WHY do you have two different versions of svn installed? – Shadur Oct 13 '11 at 4:25

Either create an alias to it in your shell, or put its directory ahead of the other in $PATH.

share|improve this answer

If you want to switch between them on the fly, without changing your $PATH, here's a little pattern I have used over the years, after seeing a coworker use this to good effect. I assume you have a $HOME/bin already, really early in your $PATH. Create the following shell script there,

PATH="/usr/local/bin:$PATH" export PATH
exec ${1+"$@"}

called, for example "local". Then you would invoke the version of svn in /usr/local/bin with the call:

$ local svn {whatever other arguments you need}

and just calling svn without this wrapper script will find whatever one is first on your $PATH.

share|improve this answer
I should add that this pattern is most useful if you have two (or more) scripts: for example "stock" and "beta", or "sysv" and "bsd", or "gnu" and "stock". – Gordon Broom Oct 13 '11 at 6:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.