1*85c225b1Smillert.\" $OpenBSD: which.1,v 1.25 2016/01/14 21:54:24 millert 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*85c225b1Smillert.Dd $Mdocdate: January 14 2016 $ 33df930be7Sderaadt.Dt WHICH 1 3471e895c5Smillert.Os 35df930be7Sderaadt.Sh NAME 36df930be7Sderaadt.Nm which 3773d4fc9bSjmc.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 61*85c225b1Smillertis not set or is empty, 6271e895c5Smillert.Nm 63*85c225b1Smillertwill use the system's default search path. 6471e895c5Smillert.El 65f1c64ac4Sjmc.Sh EXIT STATUS 66f1c64ac4SjmcThe 67f1c64ac4Sjmc.Nm 68f1c64ac4Sjmcutility exits with one of the following values: 69f1c64ac4Sjmc.Pp 70f1c64ac4Sjmc.Bl -tag -width Ds -offset indent -compact 71f1c64ac4Sjmc.It 0 72f1c64ac4SjmcAll names were successfully resolved. 73f1c64ac4Sjmc.It 1 74f1c64ac4SjmcSome names were resolved but not all. 75f1c64ac4Sjmc.It 2 76f1c64ac4SjmcNo names were resolved. 77f1c64ac4Sjmc.El 782aeff9fbSjmc.Sh DIAGNOSTICS 792aeff9fbSjmcA diagnostic is given if an executable file with the argument 802aeff9fbSjmcname was not found in the path. 8171e895c5Smillert.Sh SEE ALSO 8271e895c5Smillert.Xr csh 1 , 83cdfafdeaSaaron.Xr find 1 , 84cdfafdeaSaaron.Xr locate 1 , 853d908e8eSmillert.Xr whereis 1 , 8671e895c5Smillert.Xr environ 7 87d406b0bbSjmc.Sh STANDARDS 88d406b0bbSjmc.Nm 89d406b0bbSjmcalso exists as a built-in to 90d406b0bbSjmc.Xr csh 1 , 91d406b0bbSjmcthough with a different syntax. 9271e895c5Smillert.Sh HISTORY 9371e895c5SmillertA 9471e895c5Smillert.Nm 95c28dcedbSschwarzecommand first appeared in 96df930be7Sderaadt.Bx 3.0 . 9777dd7333Sjmc.Pp 98c28dcedbSschwarzeThe 99c28dcedbSschwarze.Fl a 100c28dcedbSschwarzeoption first appeared in 101c28dcedbSschwarze.Ox 2.3 . 102