Annotation of src/usr.bin/which/which.1, Revision 1.7
1.7 ! deraadt 1: .\" $OpenBSD: which.1,v 1.6 1998/01/28 17:18:52 millert 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.1 deraadt 44: .Op Ar name
45: .Ar ...
46: .Sh DESCRIPTION
47: .Nm Which
48: takes a list of names and looks for the files which would be
49: executed had these names been given as commands.
1.4 millert 50: Each argument is searched for along the user's path.
1.6 millert 51: .Pp
52: If the
53: .Fl a
54: flag is given,
55: .Nm
56: will return a list of all matches instead of just the first match.
1.4 millert 57: .Sh RETURN VALUES
1.3 niklas 58: The
1.4 millert 59: .Nm
1.3 niklas 60: utility exits with one of the following values:
61: .Bl -tag -width 4n
62: .It 0
63: All names got successfully resolved.
64: .It 1
65: Some names got resolved but not all.
66: .It 2
67: No names got resolved.
1.4 millert 68: .It -1
69: A system error occurred.
1.3 niklas 70: .El
1.4 millert 71: .Sh DIAGNOSTICS
72: A diagnostic is given if an executable file with the argument
73: name was not found in the path.
1.7 ! deraadt 74: .Sh ENVIRONMENT
1.4 millert 75: .Bl -tag -width PATH
76: .It Ev PATH
77: .Nm
78: uses the environment variable
79: .Ev PATH
80: as a colon-separated list of directories in which to find executables.
81: If
82: .Ev PATH
83: is not set, and the given name is not a fully-qualified
84: or relative pathname,
85: .Nm
86: will fail.
1.1 deraadt 87: .El
1.4 millert 88: .Sh CAVEATS
89: The
90: .Nm
91: command formerly was a
92: .Xr csh 1
93: script and could expand aliases.
94: .Xr csh 1
95: now has a built-in
96: .Nm
97: comand so this version is intended for use
98: with other shells like
99: .Xr sh 1 .
100: .Sh SEE ALSO
1.1 deraadt 101: .Xr csh 1 ,
1.4 millert 102: .Xr sh 1 ,
1.5 millert 103: .Xr whereis 1 ,
1.4 millert 104: .Xr environ 7
1.1 deraadt 105: .Sh HISTORY
1.4 millert 106: A
1.1 deraadt 107: .Nm
108: command appeared in
109: .Bx 3.0 .