xref: /freebsd/usr.bin/which/which.1 (revision 6c7216df785592bb069469113f556dfd1946ed5d)
1c5e7e03aSRuslan Ermilov.\" Manpage Copyright (c) 1995, Jordan Hubbard <jkh@FreeBSD.org>
29d6b1253SJordan K. Hubbard.\"
39d6b1253SJordan K. Hubbard.\" Redistribution and use in source and binary forms, with or without
49d6b1253SJordan K. Hubbard.\" modification, are permitted provided that the following conditions
59d6b1253SJordan K. Hubbard.\" are met:
69d6b1253SJordan K. Hubbard.\" 1. Redistributions of source code must retain the above copyright
79d6b1253SJordan K. Hubbard.\"    notice, this list of conditions and the following disclaimer.
89d6b1253SJordan K. Hubbard.\" 2. Redistributions in binary form must reproduce the above copyright
99d6b1253SJordan K. Hubbard.\"    notice, this list of conditions and the following disclaimer in the
109d6b1253SJordan K. Hubbard.\"    documentation and/or other materials provided with the distribution.
119d6b1253SJordan K. Hubbard.\" 3. All advertising materials mentioning features or use of this software
129d6b1253SJordan K. Hubbard.\"    must display the following acknowledgement:
139d6b1253SJordan K. Hubbard.\"      This product includes software developed by the FreeBSD Project
149d6b1253SJordan K. Hubbard.\"      its contributors.
159d6b1253SJordan K. Hubbard.\" 4. Neither the name of the FreeBSD Project nor the names of its contributors
169d6b1253SJordan K. Hubbard.\"    may be used to endorse or promote products derived from this software
179d6b1253SJordan K. Hubbard.\"    without specific prior written permission.
183819b413SWolfram Schneider.\"
199d6b1253SJordan K. Hubbard.\" THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTOR ``AS IS'' AND ANY EXPRESS OR
209d6b1253SJordan K. Hubbard.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
219d6b1253SJordan K. Hubbard.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
229d6b1253SJordan K. Hubbard.\" IN NO EVENT SHALL THE CONTRIBUTOR BE LIABLE FOR ANY DIRECT, INDIRECT,
239d6b1253SJordan K. Hubbard.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
249d6b1253SJordan K. Hubbard.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
259d6b1253SJordan K. Hubbard.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
269d6b1253SJordan K. Hubbard.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
279d6b1253SJordan K. Hubbard.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
289d6b1253SJordan K. Hubbard.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
299d6b1253SJordan K. Hubbard.\"
30c3aac50fSPeter Wemm.\" $FreeBSD$
31ea2a88d9SRuslan Ermilov.\"
32ea2a88d9SRuslan Ermilov.Dd June 21, 2002
339d6b1253SJordan K. Hubbard.Dt WHICH 1
3462500372SRuslan Ermilov.Os
359d6b1253SJordan K. Hubbard.Sh NAME
369d6b1253SJordan K. Hubbard.Nm which
379d6b1253SJordan K. Hubbard.Nd "locate a program file in the user's path"
389d6b1253SJordan K. Hubbard.Sh SYNOPSIS
398fe908efSRuslan Ermilov.Nm
4035bff0b9SSatoshi Asami.Op Fl as
419d6b1253SJordan K. Hubbard.Op Ar command
429d6b1253SJordan K. Hubbard.Ar ...
439d6b1253SJordan K. Hubbard.Sh DESCRIPTION
44e8937ba0SPhilippe CharnierThe
45e8937ba0SPhilippe Charnier.Nm
46e8937ba0SPhilippe Charnierutility
479d6b1253SJordan K. Hubbardtakes a list of command names and searches the path for each executable
489d6b1253SJordan K. Hubbardfile that would be run had these commands actually been invoked.
4935bff0b9SSatoshi Asami.Pp
5035bff0b9SSatoshi AsamiThe following options are available:
5135bff0b9SSatoshi Asami.Bl -tag -width indent
5235bff0b9SSatoshi Asami.It Fl a
5335bff0b9SSatoshi AsamiList all instances of executables found (instead of just the first one
5435bff0b9SSatoshi Asamiof each).
5535bff0b9SSatoshi Asami.It Fl s
5635bff0b9SSatoshi AsamiNo output, just return 0 if any of the executables are found, or 1 if
5735bff0b9SSatoshi Asaminone are found.
5821a6eb09SSheldon Hearn.El
59c644db6aSSheldon Hearn.Pp
60c644db6aSSheldon HearnSome shells may provide a builtin
61c644db6aSSheldon Hearn.Nm
62e6d3cf26SSheldon Hearncommand which is similar or identical to this utility.
63e6d3cf26SSheldon HearnConsult the
64c644db6aSSheldon Hearn.Xr builtin 1
65c644db6aSSheldon Hearnmanual page.
669d6b1253SJordan K. Hubbard.Sh SEE ALSO
67c644db6aSSheldon Hearn.Xr builtin 1 ,
68c644db6aSSheldon Hearn.Xr csh 1 ,
6941cbb624SJoseph Koshy.Xr find 1 ,
7041cbb624SJoseph Koshy.Xr locate 1 ,
716a34c725SJoseph Koshy.Xr whereis 1
726c7216dfSRuslan Ermilov.Sh HISTORY
736c7216dfSRuslan ErmilovThe
746c7216dfSRuslan Ermilov.Nm
756c7216dfSRuslan Ermilovcommand first appeared in
766c7216dfSRuslan Ermilov.Fx 2.1 .
77306005e7SPhilippe Charnier.Sh AUTHORS
78ea2a88d9SRuslan Ermilov.An -nosplit
79ea2a88d9SRuslan ErmilovThe
8093a35425SPhilippe Charnier.Nm
81ea2a88d9SRuslan Ermilovutility was originally written in Perl and was contributed by
8293a35425SPhilippe Charnier.An Wolfram Schneider Aq wosch@FreeBSD.org .
83ea2a88d9SRuslan ErmilovThe current version of
84ea2a88d9SRuslan Ermilov.Nm
85ea2a88d9SRuslan Ermilovwas rewritten in C by
86ea2a88d9SRuslan Ermilov.An Daniel Papasian Aq dpapasia@andrew.cmu.edu .
87