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?

link|improve this question

75% accept rate
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
feedback

1 Answer

up vote 0 down vote accepted

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

link|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: stackoverflow.com/questions/334879/… – shellholic Feb 12 '11 at 21:33
show 1 more comment
feedback

Your Answer

 
or
required, but never shown

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