def which(name) ENV['PATH'].split(':').map { |p| File.join p, name }.find { |p| File.file? p and File.executable? p } end