def whereis(prog, path = ENV['PATH'])
      dirs = []
      path.split(File::PATH_SEPARATOR).each do |dir|
        f = File.join(dir,prog)
        if File.executable?(f) && !File.directory?(f)
          if block_given?
            yield f
          else
            dirs << f
          end
        end
      end
      
      dirs.empty? ? nil : dirs
    end
def whereis(prog, path = ENV['PATH'])
      dirs = []
      path.split(File::PATH_SEPARATOR).each do |dir|
        f = File.join(dir,prog)
        if File.executable?(f) && !File.directory?(f)
          if block_given?
            yield f
          else
            dirs << f
          end
        end
      end
      
      dirs.empty? ? nil : dirs
    end
In block form, yields each program within path. In non-block form,
 returns an array of each program within path. Returns nil if not found
 found.

 @example
   whereis('ruby')
     # => [
         [0] "/opt/chefdk/embedded/bin/ruby",
         [1] "/usr/bin/ruby",
         [2] "/Users/sharding/.rvm/rubies/ruby-2.2.0/bin/ruby",
         [3] "/usr/bin/ruby"
     ]

 @param [String] cmd
   The name of the command to find.

 @param [String] path
   The path to search for the command.

 @return [String, Array, NilClass]

 @api public