version 1.11, 1999/10/07 19:15:25 |
version 1.12, 2000/03/14 14:58:26 |
|
|
.\" $OpenBSD$ |
.\" $OpenBSD$ |
|
.\" |
.\" Copyright (c) 1980, 1991 Regents of the University of California. |
.\" Copyright (c) 1980, 1991 Regents of the University of California. |
.\" All rights reserved. |
.\" All rights reserved. |
.\" |
.\" |
|
|
.Op Fl a |
.Op Fl a |
.Ar name Op Ar ... |
.Ar name Op Ar ... |
.Sh DESCRIPTION |
.Sh DESCRIPTION |
.Nm which |
.Nm |
takes a list of names and looks for the files which would be |
takes a list of names and looks for the files which would be |
executed had these names been given as commands. |
executed had these names been given as commands. |
Each argument is searched for along the user's path. |
Each argument is searched for along the user's path. |
|
|
flag is given, |
flag is given, |
.Nm |
.Nm |
will return a list of all matches instead of just the first match. |
will return a list of all matches instead of just the first match. |
.Sh RETURN VALUES |
.Pp |
The |
The |
.Nm |
.Nm |
utility exits with one of the following values: |
utility exits with one of the following values: |
|
|
Some names were resolved but not all. |
Some names were resolved but not all. |
.It 2 |
.It 2 |
No names were resolved. |
No names were resolved. |
.It -1 |
.It \-1 |
A system error occurred. |
A system error occurred. |
.El |
.El |
.Sh DIAGNOSTICS |
.Sh DIAGNOSTICS |
A diagnostic is given if an executable file with the argument |
A diagnostic is given if an executable file with the argument |
name was not found in the path. |
name was not found in the path. |
.Sh ENVIRONMENT |
.Sh ENVIRONMENT |
|
The following environment variables affect the execution of |
|
.Nm which : |
.Bl -tag -width PATH |
.Bl -tag -width PATH |
.It Ev PATH |
.It Ev PATH |
.Nm |
A colon-separated list of directories in which to find executables. |
uses the environment variable |
|
.Ev PATH |
|
as a colon-separated list of directories in which to find executables. |
|
If |
If |
.Ev PATH |
.Ev PATH |
is not set, and the given name is not a fully qualified |
is not set, and the given name is not a fully qualified |
|
|
.Nm |
.Nm |
will fail. |
will fail. |
.El |
.El |
.Sh CAVEATS |
|
The |
|
.Nm |
|
command formerly was a |
|
.Xr csh 1 |
|
script and could expand aliases. |
|
.Xr csh 1 |
|
now has a built-in |
|
.Nm |
|
command so this version is intended for use |
|
with other shells like |
|
.Xr sh 1 . |
|
.Sh SEE ALSO |
.Sh SEE ALSO |
.Xr csh 1 , |
.Xr csh 1 , |
.Xr find 1 , |
.Xr find 1 , |
|
|
.Nm |
.Nm |
command appeared in |
command appeared in |
.Bx 3.0 . |
.Bx 3.0 . |
|
.Sh CAVEATS |
|
The |
|
.Nm |
|
command formerly was a |
|
.Xr csh 1 |
|
script and could expand aliases. |
|
.Xr csh 1 |
|
now has a built-in |
|
.Nm |
|
command so this version is intended for use |
|
with other shells like |
|
.Xr sh 1 . |