home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / os2 / whch20gr.zip / WHICH.DOC < prev    next >
Text File  |  1993-05-03  |  4KB  |  101 lines

  1.  
  2. WHICH(1)                 USER COMMANDS                   WHICH(1)
  3.  
  4. NAME
  5.      which - locate commands
  6.  
  7. SYNOPSIS
  8.      which [ -a ] [ -l | -d ] command [ command ... ]
  9.  
  10. ARGUMENTS
  11.      command  Command or list of commands (or files) to locate.
  12.  
  13. OPTIONS
  14.      -a  list all matches, not just first one
  15.      -l  search LIBPATH for DLLs
  16.      -d  search DPATH for data files
  17.  
  18. DESCRIPTION
  19.      By default which  checks,  in  order,  a  list  of  internal
  20.      command-shell  commands,  the  current directory, and direc-
  21.      tories specified in the user's PATH variable  for  the  com-
  22.      mands  given as its arguments.  If a given command is found,
  23.      its full path is printed; otherwise a ``not found''  message
  24.      is  printed  with  a  list  of  the  directories  which were
  25.      checked.  In the case the command is an internal shell  com-
  26.      mand, a message to this effect is printed in lieu of a path.
  27.  
  28.      which respects the shell precedence of  command  extensions;
  29.      thus  more.com  is  listed  instead of more.exe, should both
  30.      exist in the same directory.  Likewise, .exe files have pre-
  31.      cedence  over .cmd files, and .cmd files over .bat files.  A
  32.      command with a dot in  its  name  has  precedence  over  any
  33.      default  extension;  for  example,  list.old is found before
  34.      list.old.exe.
  35.  
  36.      The -a option causes which to list all matching commands  in
  37.      the  path, not just the one which would be executed.  The -d
  38.      and -l options alter the nature of the search;  when  -d  is
  39.      specified,  which searches directories in the DPATH for data
  40.      files, and when -l is specified,  it  searches  through  the
  41.      LIBPATH  for  dynamic link libraries (.DLLs).  The -d and -l
  42.      options are  mutually  exclusive,  and  in  both  cases  the
  43.      current directory is searched only if ``.'' is listed in the
  44.      appropriate path.
  45.  
  46. EXAMPLES
  47.      To find the locations of four commands:
  48.  
  49.           which dir format unzip zipinfo
  50.  
  51.      The output might look something like the following:
  52.  
  53.           dir:  CMD.EXE internal command
  54.           c:\os2\format.com
  55.           c:\utils\32\unzip.exe
  56.           no zipinfo in . c:\os2 c:\utils\32 c:\utils\16
  57.             c:\utils\bnd c:\os2\system c:\emx\bin
  58.             c:\groff\bin c:\os2\mdos\winos2 c:\os2\install
  59.             c:\ c:\os2\mdos c:\os2\apps c:\ibmtk\os2bin
  60.             c:\ibmwf\bin c:\ibmc\bin
  61.  
  62.      To locate all copies of the  emx.dll  dynamic  link  library
  63.      (the  first  one listed is the one which will be used by the
  64.      operating system):
  65.  
  66.           which -al emx
  67.  
  68.      To find two of the IBM Redbooks (.inf format):
  69.  
  70.           which -d gg243732 gg243774
  71.  
  72. SEE ALSO
  73.      csh(1)
  74.  
  75. BUGS
  76.      The list of internal shell commands is static and  does  not
  77.      reflect  differences between various versions of the command
  78.      shell.  The current command lists correspond roughly to OS/2
  79.      2.0, MS-DOS 5.0, 4OS2 1.1 and 4DOS 4.0.
  80.  
  81.      The LIBPATH cannot reasonably be determined in  a  foolproof
  82.      manner;  it  does not have a corresponding environment vari-
  83.      able or system call.  which looks in the  config.sys  system
  84.      file  for LIBPATH, but this can fail if the LIBPATH line has
  85.      been edited since the system was last booted.  In  addition,
  86.      since  which  first  checks  for  \config.sys on the current
  87.      drive and then on drive c:, it can find the wrong file  (for
  88.      example,  if  the system was booted from floppy drive a: and
  89.      the current directory is c:).
  90.  
  91.      The list of ``proper'' extensions  for  use  with  DPATH  is
  92.      somewhat  hazy;  the  following  are  presently used:  .boo,
  93.      .dat, .hlp, .inf, .ini, .msg and .ndx.
  94.  
  95. AUTHOR
  96.      Greg Roelofs (also known as Cave Newt).   The  makefile  was
  97.      liberally borrowed from Kai Uwe Rommel's UnZip makefile.
  98.  
  99. Newtware                                        28 Apr 93 (v2.02)
  100.  
  101.