#!/usr/bin/python from commands import getoutput from sys import exit python_names = getoutput("head -n 1 * 2> /dev/null | grep -a '#!' | grep -a python").split("\n") if not "python" in python_names[0]: print "No python scrips found" exit() print "Python 3: ", len([pn for pn in python_names if "python3" in pn]) print "Python 2: ", len([pn for pn in python_names if not "python3" in pn]) print "env uses: ", len([pn for pn in python_names if "env" in pn])