This is casting the net too widely, IMHO.  Instead, can you loop through a small list of known paths?  The folks at Joyent ought to be able to provide their known install locations, and for Linux you can probably safely assume `/usr/local/bin`, `/usr/bin`.