最强大的which whereis 命令

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

# which.rb xxx
#
name = ARGV[0]
inc = ENV['INCLUDE'].split(/;/) rescue []
lib = ENV['LIB'].split(/;/) rescue []
a = ENV['PATH'].split(/;/) | $: | inc | lib
a << inc.map{|x| x + '\\sys'}
a << inc.map{|x| x + '\\gl'}

#p a

a.flatten.each{|path|
   path.gsub!(/\\/,'/')
   Dir[File.join( path,'*'+name+'*')].each{|x|
      print "#{x}\n"
   }
}