determining if an executable is in the search path
am 02.11.2007 19:32:51 von Russ.PaielliIn bash, how can one test whether an executable program is found in
the executable search path? Thanks.
In bash, how can one test whether an executable program is found in
the executable search path? Thanks.
2007-11-02, 18:32(-00), Russ P.:
> In bash, how can one test whether an executable program is found in
> the executable search path? Thanks.
if command -v cmd > /dev/null 2>&1; then
echo "there is a cmd command available"
fi
If you want to search for cmd in $PATH and not as a builtin or
function, you can use type -P instead of "command -v" but that's
bash specific.
--
Stéphane