Super User is a question and answer site for computer enthusiasts and power users. 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 want to check in a shell script whether subversion is installed. For that I chose to check the exit code after the program has been executed. I tried using command svn, but that prints out the output of the command (Type 'svn help' for usage.). If I suppress it with 2>/dev/null the result is an empty string.

How could I make it work?

share|improve this question
you should work a bit on your 'accept-answers' rate ... – akira Feb 12 '11 at 19:26
@akira - should I care? If I don't get a satisfying answer, I don't approve any. If that's what that is about... – jurchiks Feb 12 '11 at 19:33
up vote 1 down vote accepted

The exit code of the last executed program is stored in $?.

share|improve this answer
... "so do a echo $? and have a look". – akira Feb 12 '11 at 19:25
@shellholic - thx, helped. @akira - stop post-hunting... – jurchiks Feb 12 '11 at 19:34
@jurchiks: stopping what? – akira Feb 12 '11 at 20:12
@shellholic - do you, by any chance, know, how to do the same in Windows? I'm writing the same script for both Windows and Linux. – jurchiks Feb 12 '11 at 21:05
@jurchiks answered here:… – shellholic Feb 12 '11 at 21:33

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.