#!/bin/sh # Use any-python as interpreter in portable Python scripts. # Instead of /usr/bin/env python use /usr/bin/env any-python # The preferred choices are: Python 3, Python 2, anything called "python" py3="$(command -v python3)" py2="$(command -v python2)" py_dunno="$(command -v python)" if [ -n "$py3" ]; then exec "$py3" "$@" elif [ -n "$py2" ]; then exec "$py2" "$@" elif [ -n "$py_dunno" ]; then exec "$py_dunno" "$@" else echo "cannot find any Python installation" >&2 exit 1 fi