#!/bin/bash

shopt  -s nullglob

verbose=False

function usage
{
    retval="$1"
    echo "$0 -v --help" 1>&2
    exit "$retval"
}

while [ "$#" -ge 1 ]
do
    case "$1" in
        -v)
            verbose=True
            ;;
        --help|-h)
            usage 0
            ;;
        -*)
            echo "$0: Unrecognized option: $1" 1>&2
            usage 1
            ;;
        *)
            command="$1"
            ;;
    esac
    shift
done

for interp in /usr/local/cpython-*/bin/python /usr/local/pypy-*/bin/pypy /usr/local/jython-*/bin/jython
do
    (
    if output=$("$interp" -c "$command" 2>&1)
    then
        echo "$interp!has it" | tr -d '\012'
    else
        echo "$interp!does not have it" | tr -d '\012'
    fi
    case "$verbose" in
        True)
            echo "!$output"
            ;;
        False)
            echo
            ;;
        *)
            echo "$0: Internal error: Bad boolean value: $verbose" 1>&2
            exit 1
            ;;
    esac
    ) | tr '!' '\011' | expand -50,70
done