Table of Contents
Previous Sample | List of Samples | Next Sample

Which.csh


#  which.csh, Release 2.3.g
#  Copyright (c) 1998-2000 by Hamilton Laboratories.  All rights reserved.

proc which (cmd)

   #  Figure out what will be run if cmd is typed.
   #  The search order is:
   #     1. Aliases
   #     2. Procedures
   #     3. Executable files

   local save_nonovar
   @ save_nonovar = nonovar
   @ nonovar = 2
   if (cmd !~ "*.*") then
      if (`eval alias $cmd | wc -l`) then
         echo -n 'alias '
         eval alias $cmd
      else
         if (`eval proc $cmd | wc -l`) then
            echo -n 'proc  '
            eval proc $cmd
         else
            whereis $cmd |& head -1
         end
      end
   else
      whereis $cmd |& head -1
   end
   @ nonovar = save_nonovar
end

which $argv



Previous Sample | List of Samples | Next Sample
Table of Contents



Copyright © 1988-2003 by Hamilton Laboratories. All rights reserved.