# whereis.csh # Look through the directories on the search path for any files corresponding # to the command name given, reporting anything that's found, trying each # try each of the six possibilities, no extension, .csh, .exe, .com, .cmd # and .bat, in each directory. # This is an example of a self-loading procedure. The first time # it is referenced, it runs as a .csh script, defining and running # the whereis proc. Successive calls directly invoke the pre-compiled # procedure and will run slightly faster. (View this file with TABS=3.) proc whereis(name) local i, j if ($#name) then if ($#name > 1) @ name = name[0] foreach i ($path) if (i =~ "*\") then if (-e $i$name) echo $i$name foreach j (.csh .exe .com .cmd .bat) if (-e $i$name$j) echo $i$name$j end else if (-e $i\$name) echo $i\$name foreach j (.csh .exe .com .cmd .bat) if (-e $i\$name$j) echo $i\$name$j end end end end end whereis $argv |