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