The find command?
find
find /bin -name bibtex -type f
Looks for a file name "bibtex" of type "f", which is a regular file.
locate --basename '\bibtex' --limit 1
Eliminates the need for grep and head, but still doesn't solve the issue of whether the result is a directory.
grep
head
Why don't you do:
type -P bibtex
which will look in the PATH for a program by that name?
PATH
I don't understand exactly so maybe my solution is wrong: why don't you use which? Or bibtex isn't in PATH?