Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm looking for something like this:

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

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.