I'm trying to use grep to automatically locate the bibtex program in the user's bin folder.
The problem is, it frequently returns a directory with the name bibtex, which means that the script fails to automatically run the command.
How can I force grep (or indeed the locate command) to automatically ignore directories?
EDIT: The current command is: locate bibtex | grep "/bibtex$" -d skip | head -n1