Is there a builtin way to ask a current shell "find me all of the possible matches for a given command in the PATH?"
I realize that I could write a script that:
- expands the current PATH
- checks for the existence of a given command in all of these locations
- prints the results
but I've also found that linux very often has builtin magical shortcuts for stuff like this
Another way to consider this use case is as a general answer to something like "if I type which [whatever]
, how do I know programmatically what happens if the first hit in the path is NOT there?" ... and so on.