Find a file in the path without "which"?

Use this command: type assemble.sh

It works in a variety of shells and shows only the first result.


Or split the path, and use it in find - the first match should be the solution

find ${PATH//:/ } -maxdepth 1 -name assemble.sh -print -quit

type is of course more easy.


You may be using bash, but the syntax of the which output shows that you use the old which written in csh. The PATH shows up quoted by parentheses, and the directories in PATH have entries like /opt/SUNWspro/bin and /usr/ccs/bin which only make sense in Solaris. That's consistent: Solaris used the csh which.

Here's my guess: you've got one PATH for bash, and another for csh. This might be a system problem. As I recall, Solaris keeps /etc/profile and /etc/cshrc files for system-wide PATH setting. Those two initialization files might set different PATH variables for different shells. Do "echo $PATH" under bash, and see if it agrees with what the which command prints out as a PATH string.

Tags:

Shell

Bash

Path