Check python version in script
August 10, 2011 14:58:49 Last update: August 10, 2011 14:58:49
In python:
In shell script:
#!/usr/local/bin/python import sys if sys.version_info >= (2, 6): print "Version accepted" else: print "Version too old"
In shell script:
#!/bin/bash PYTHON=/usr/local/bin/python # Make sure python is 2.6 or later PYTHON_OK=`$PYTHON -c 'import sys print (sys.version_info >= (2, 6) and "1" or "0")'` echo "python ok: $PYTHON_OK" if [ "$PYTHON_OK" = '0' ]; then echo "Python version too old" fi
Easy email testing with http://www.ximailstop.com