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'm looking for something like this:

if [ "`python2.7 -V`" == "Python 2.7" ] ;then
    echo "woh"

inside the if statement ... check to see if running the command

$ python2.7 -V

returns the string "Python 2.7"

share|improve this question
Did you try it? – geekosaur Apr 25 '12 at 1:30
haha yes i tried it .. and it doesnt print "woh" – delinquentme Apr 25 '12 at 1:32
up vote 2 down vote accepted

python -V sends its output to stderr.

[ "`python2.7 -V 2>&1`" == "Python 2.7" ]
share|improve this answer
Works like a charm! – delinquentme Apr 25 '12 at 2:21

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.