tested on Fedora 32 with bash 5.0.17 and curl 7.69.1
- Clone this gist
git clone https://gist.github.com/d76bd27fbc4b8ab6d683822cdf61f81d.git bash-refine
def which(program): | |
""" return `None` if no executable can be found | |
""" | |
def is_exe(fpath): | |
return os.path.isfile(fpath) and os.access(fpath, os.X_OK) | |
fpath, fname = os.path.split(program) | |
if fpath: | |
if is_exe(program): | |
return program |