I want to check the current version of python is the one I expect in a bash script.
python --version | grep --quiet 'Python 2.7.12 :: Continuum Analytics'
if [ $? == 0 ]; then
    echo "python version ok"
fi
But the grep command always returns 1, instead of 0, even when I get a good match, even with a simple grep 'Python'.  To check it, echo "${PIPESTATUS[1]}" Returns 1
If I pipe some other output to grep, it works as expected, for instance:
echo 'Python 2.7.12 :: Continuum Analytics' | grep --quiet 'Python 2.7.12 :: Continuum Analytics'
This works properly, and echo "${PIPESTATUS[1]}" Returns 0
What is going wrong with the python --version command piped to grep?  how can we fix it?
 
    