determining if an executable is in the search path
In bash, how can one test whether an executable program is found in
the executable search path? Thanks.
Re: determining if an executable is in the search path
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