#!/usr/bin/env bash set -eu pyver="$1" if [ -e /usr/local/$pyver/bin/python ] then python=/usr/local/$pyver/bin/python elif [ -e ./this-$pyver ] then python=./this-$pyver elif [ -e ../this-$pyver ] then python=../this-$pyver elif [ -e ../../this-$pyver ] then python=../../this-$pyver elif [ -e ../../../this-$pyver ] then python=../../../this-$pyver else echo "$0: No python $pyver found" 1>&2 exit 1 fi echo "$python"