How can we go about making the code for getent a bit more general with respect to non-traditional locations for the binary? I ran into this while troubleshooting mdns on NixOS and not having a functional getent, but the replacement provided in compaudit. (share/zsh/5.2/function/compaudit).

-[[ -x /usr/bin/getent ]] || getent() {
+[[ -n ${commands[getent]} ]] || getent() {



I brought this up at https://github.com/NixOS/nixpkgs/issues/20138 where the attached solution was suggested by Mic92.