home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
os2
/
whch20gr.zip
/
WHICH.DOC
< prev
next >
Wrap
Text File
|
1993-05-03
|
4KB
|
101 lines
WHICH(1) USER COMMANDS WHICH(1)
NAME
which - locate commands
SYNOPSIS
which [ -a ] [ -l | -d ] command [ command ... ]
ARGUMENTS
command Command or list of commands (or files) to locate.
OPTIONS
-a list all matches, not just first one
-l search LIBPATH for DLLs
-d search DPATH for data files
DESCRIPTION
By default which checks, in order, a list of internal
command-shell commands, the current directory, and direc-
tories specified in the user's PATH variable for the com-
mands given as its arguments. If a given command is found,
its full path is printed; otherwise a ``not found'' message
is printed with a list of the directories which were
checked. In the case the command is an internal shell com-
mand, a message to this effect is printed in lieu of a path.
which respects the shell precedence of command extensions;
thus more.com is listed instead of more.exe, should both
exist in the same directory. Likewise, .exe files have pre-
cedence over .cmd files, and .cmd files over .bat files. A
command with a dot in its name has precedence over any
default extension; for example, list.old is found before
list.old.exe.
The -a option causes which to list all matching commands in
the path, not just the one which would be executed. The -d
and -l options alter the nature of the search; when -d is
specified, which searches directories in the DPATH for data
files, and when -l is specified, it searches through the
LIBPATH for dynamic link libraries (.DLLs). The -d and -l
options are mutually exclusive, and in both cases the
current directory is searched only if ``.'' is listed in the
appropriate path.
EXAMPLES
To find the locations of four commands:
which dir format unzip zipinfo
The output might look something like the following:
dir: CMD.EXE internal command
c:\os2\format.com
c:\utils\32\unzip.exe
no zipinfo in . c:\os2 c:\utils\32 c:\utils\16
c:\utils\bnd c:\os2\system c:\emx\bin
c:\groff\bin c:\os2\mdos\winos2 c:\os2\install
c:\ c:\os2\mdos c:\os2\apps c:\ibmtk\os2bin
c:\ibmwf\bin c:\ibmc\bin
To locate all copies of the emx.dll dynamic link library
(the first one listed is the one which will be used by the
operating system):
which -al emx
To find two of the IBM Redbooks (.inf format):
which -d gg243732 gg243774
SEE ALSO
csh(1)
BUGS
The list of internal shell commands is static and does not
reflect differences between various versions of the command
shell. The current command lists correspond roughly to OS/2
2.0, MS-DOS 5.0, 4OS2 1.1 and 4DOS 4.0.
The LIBPATH cannot reasonably be determined in a foolproof
manner; it does not have a corresponding environment vari-
able or system call. which looks in the config.sys system
file for LIBPATH, but this can fail if the LIBPATH line has
been edited since the system was last booted. In addition,
since which first checks for \config.sys on the current
drive and then on drive c:, it can find the wrong file (for
example, if the system was booted from floppy drive a: and
the current directory is c:).
The list of ``proper'' extensions for use with DPATH is
somewhat hazy; the following are presently used: .boo,
.dat, .hlp, .inf, .ini, .msg and .ndx.
AUTHOR
Greg Roelofs (also known as Cave Newt). The makefile was
liberally borrowed from Kai Uwe Rommel's UnZip makefile.
Newtware 28 Apr 93 (v2.02)