1*c28dcedbSschwarze.\" $OpenBSD: which.1,v 1.22 2011/10/09 02:20:39 schwarze Exp $ 243b6428bSaaron.\" 3df930be7Sderaadt.\" Copyright (c) 1980, 1991 Regents of the University of California. 4df930be7Sderaadt.\" All rights reserved. 5df930be7Sderaadt.\" 6df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without 7df930be7Sderaadt.\" modification, are permitted provided that the following conditions 8df930be7Sderaadt.\" are met: 9df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright 10df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer. 11df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright 12df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer in the 13df930be7Sderaadt.\" documentation and/or other materials provided with the distribution. 14f75387cbSmillert.\" 3. Neither the name of the University nor the names of its contributors 15df930be7Sderaadt.\" may be used to endorse or promote products derived from this software 16df930be7Sderaadt.\" without specific prior written permission. 17df930be7Sderaadt.\" 18df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21df930be7Sderaadt.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28df930be7Sderaadt.\" SUCH DAMAGE. 29df930be7Sderaadt.\" 30df930be7Sderaadt.\" from: @(#)which.1 6.3 (Berkeley) 4/23/91 31df930be7Sderaadt.\" 32*c28dcedbSschwarze.Dd $Mdocdate: October 9 2011 $ 33df930be7Sderaadt.Dt WHICH 1 3471e895c5Smillert.Os 35df930be7Sderaadt.Sh NAME 36df930be7Sderaadt.Nm which 3771e895c5Smillert.Nd "locate a program file (or files) in the path" 38df930be7Sderaadt.Sh SYNOPSIS 39df930be7Sderaadt.Nm which 40d27b3816Smillert.Op Fl a 414bdcd61aSsobrado.Ar name ... 42df930be7Sderaadt.Sh DESCRIPTION 4343b6428bSaaron.Nm 44df930be7Sderaadttakes a list of names and looks for the files which would be 45df930be7Sderaadtexecuted had these names been given as commands. 4671e895c5SmillertEach argument is searched for along the user's path. 47d27b3816Smillert.Pp 48d27b3816SmillertIf the 49d27b3816Smillert.Fl a 50d27b3816Smillertflag is given, 51d27b3816Smillert.Nm 52d27b3816Smillertwill return a list of all matches instead of just the first match. 5341371632Sderaadt.Sh ENVIRONMENT 5443b6428bSaaronThe following environment variables affect the execution of 5543b6428bSaaron.Nm which : 5671e895c5Smillert.Bl -tag -width PATH 5771e895c5Smillert.It Ev PATH 5843b6428bSaaronA colon-separated list of directories in which to find executables. 5971e895c5SmillertIf 6071e895c5Smillert.Ev PATH 61892a7bb8Saaronis not set, and the given name is not a fully qualified 6271e895c5Smillertor relative pathname, 6371e895c5Smillert.Nm 6471e895c5Smillertwill fail. 6571e895c5Smillert.El 66f1c64ac4Sjmc.Sh EXIT STATUS 67f1c64ac4SjmcThe 68f1c64ac4Sjmc.Nm 69f1c64ac4Sjmcutility exits with one of the following values: 70f1c64ac4Sjmc.Pp 71f1c64ac4Sjmc.Bl -tag -width Ds -offset indent -compact 72f1c64ac4Sjmc.It 0 73f1c64ac4SjmcAll names were successfully resolved. 74f1c64ac4Sjmc.It 1 75f1c64ac4SjmcSome names were resolved but not all. 76f1c64ac4Sjmc.It 2 77f1c64ac4SjmcNo names were resolved. 78f1c64ac4Sjmc.El 792aeff9fbSjmc.Sh DIAGNOSTICS 802aeff9fbSjmcA diagnostic is given if an executable file with the argument 812aeff9fbSjmcname was not found in the path. 8271e895c5Smillert.Sh SEE ALSO 8371e895c5Smillert.Xr csh 1 , 84cdfafdeaSaaron.Xr find 1 , 85cdfafdeaSaaron.Xr locate 1 , 863d908e8eSmillert.Xr whereis 1 , 8771e895c5Smillert.Xr environ 7 88d406b0bbSjmc.Sh STANDARDS 89d406b0bbSjmc.Nm 90d406b0bbSjmcalso exists as a built-in to 91d406b0bbSjmc.Xr csh 1 , 92d406b0bbSjmcthough with a different syntax. 9371e895c5Smillert.Sh HISTORY 9471e895c5SmillertA 9571e895c5Smillert.Nm 96*c28dcedbSschwarzecommand first appeared in 97df930be7Sderaadt.Bx 3.0 . 98*c28dcedbSschwarzeThe 99*c28dcedbSschwarze.Fl a 100*c28dcedbSschwarzeoption first appeared in 101*c28dcedbSschwarze.Ox 2.3 . 102