def is_sh(executable):
    """Determine if the specified executable is a .sh (contains a #! line)"""
    try:
        with io.open(executable, encoding='latin-1') as fp:
            magic = fp.read(2)
    except (OSError, IOError):
        return executable
    return magic == '#!'
Determine if the specified executable is a .sh (contains a #! line)
product/gradle-plugin/src/main/python/setuptools/command/easy_install.py