Mike Frysinger wrote:
[...]
you're thinking one level too deep

simply do:
$(shell your_script_here 2>/dev/null)
-mike

Well, yes, that's what Paul suggested. The problem is that in my
your_script_here script I'll have to do the same to prevent the shell
from complaining about foo if it doesn't exist (such as executing foo
in another subshell). I guess what I'm really looking for is an easy
way to determine whether a command exists and is executable or not.
AFAIK, the only ways to do it are:

--  try to execute it and deal with the shell error message (i.e.,
    my original problem)
--  execute it in a subshell, silence its stderr, and use its exit
    status to determine whether it exists or not (128) (i.e., use
    my "inefficient hack")
--  parse PATH and use test to see if the command exists in any of
    the directories (lots of work)

Martin


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to