Annotation of src/usr.bin/which/which.1, Revision 1.10
1.10 ! alex 1: .\" $OpenBSD: which.1,v 1.9 1999/05/12 13:26:52 aaron Exp $
1.1 deraadt 2: .\" Copyright (c) 1980, 1991 Regents of the University of California.
3: .\" All rights reserved.
4: .\"
5: .\" Redistribution and use in source and binary forms, with or without
6: .\" modification, are permitted provided that the following conditions
7: .\" are met:
8: .\" 1. Redistributions of source code must retain the above copyright
9: .\" notice, this list of conditions and the following disclaimer.
10: .\" 2. Redistributions in binary form must reproduce the above copyright
11: .\" notice, this list of conditions and the following disclaimer in the
12: .\" documentation and/or other materials provided with the distribution.
13: .\" 3. All advertising materials mentioning features or use of this software
14: .\" must display the following acknowledgement:
15: .\" This product includes software developed by the University of
16: .\" California, Berkeley and its contributors.
17: .\" 4. Neither the name of the University nor the names of its contributors
18: .\" may be used to endorse or promote products derived from this software
19: .\" without specific prior written permission.
20: .\"
21: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31: .\" SUCH DAMAGE.
32: .\"
33: .\" from: @(#)which.1 6.3 (Berkeley) 4/23/91
34: .\"
1.4 millert 35: .Dd February 21, 1997
1.1 deraadt 36: .Dt WHICH 1
1.4 millert 37: .Os
1.1 deraadt 38: .Sh NAME
39: .Nm which
1.4 millert 40: .Nd "locate a program file (or files) in the path"
1.1 deraadt 41: .Sh SYNOPSIS
42: .Nm which
1.6 millert 43: .Op Fl a
1.8 aaron 44: .Ar name Op Ar ...
1.1 deraadt 45: .Sh DESCRIPTION
1.8 aaron 46: .Nm which
1.1 deraadt 47: takes a list of names and looks for the files which would be
48: executed had these names been given as commands.
1.4 millert 49: Each argument is searched for along the user's path.
1.6 millert 50: .Pp
51: If the
52: .Fl a
53: flag is given,
54: .Nm
55: will return a list of all matches instead of just the first match.
1.4 millert 56: .Sh RETURN VALUES
1.3 niklas 57: The
1.4 millert 58: .Nm
1.3 niklas 59: utility exits with one of the following values:
60: .Bl -tag -width 4n
61: .It 0
1.8 aaron 62: All names were successfully resolved.
1.3 niklas 63: .It 1
1.8 aaron 64: Some names were resolved but not all.
1.3 niklas 65: .It 2
1.8 aaron 66: No names were resolved.
1.4 millert 67: .It -1
68: A system error occurred.
1.3 niklas 69: .El
1.4 millert 70: .Sh DIAGNOSTICS
71: A diagnostic is given if an executable file with the argument
72: name was not found in the path.
1.7 deraadt 73: .Sh ENVIRONMENT
1.4 millert 74: .Bl -tag -width PATH
75: .It Ev PATH
76: .Nm
77: uses the environment variable
78: .Ev PATH
79: as a colon-separated list of directories in which to find executables.
80: If
81: .Ev PATH
1.9 aaron 82: is not set, and the given name is not a fully qualified
1.4 millert 83: or relative pathname,
84: .Nm
85: will fail.
1.1 deraadt 86: .El
1.4 millert 87: .Sh CAVEATS
88: The
89: .Nm
90: command formerly was a
91: .Xr csh 1
92: script and could expand aliases.
93: .Xr csh 1
94: now has a built-in
95: .Nm
1.10 ! alex 96: command so this version is intended for use
1.4 millert 97: with other shells like
98: .Xr sh 1 .
99: .Sh SEE ALSO
1.1 deraadt 100: .Xr csh 1 ,
1.4 millert 101: .Xr sh 1 ,
1.5 millert 102: .Xr whereis 1 ,
1.4 millert 103: .Xr environ 7
1.1 deraadt 104: .Sh HISTORY
1.4 millert 105: A
1.1 deraadt 106: .Nm
107: command appeared in
108: .Bx 3.0 .