MirOS Manual: which(1)

WHICH(1)                     BSD Reference Manual                     WHICH(1)

NAME

     which - locate a program file (or files) in the path

SYNOPSIS

     which [-a] name [...]

DESCRIPTION

     which takes a list of names and looks for the files which would be exe-
     cuted had these names been given as commands. Each argument is searched
     for along the user's path.

     If the -a flag is given, which will return a list of all matches instead
     of just the first match.

     The which utility exits with one of the following values:

     0     All names were successfully resolved.
     1     Some names were resolved but not all.
     2     No names were resolved.
     -1    A system error occurred.

ENVIRONMENT

     The following environment variables affect the execution of which:

     PATH  A colon-separated list of directories in which to find executables.
           If PATH is not set, and the given name is not a fully qualified or
           relative pathname, which will fail.

DIAGNOSTICS

     A diagnostic is given if an executable file with the argument name was
     not found in the path.

SEE ALSO

     csh(1), find(1), locate(1), sh(1), whereis(1), environ(7)

HISTORY

     A which command appeared in 3.0BSD.

CAVEATS

     The which command formerly was a csh(1) script and could expand aliases.
     csh(1) now has a built-in which command so this version is intended for
     use with other shells like sh(1).

MirOS BSD #10-current         February 21, 1997                              1

Generated on 2014-07-04 21:17:45 by $MirOS: src/scripts/roff2htm,v 1.79 2014/02/10 00:36:11 tg Exp $

These manual pages and other documentation are copyrighted by their respective writers; their source is available at our CVSweb, AnonCVS, and other mirrors. The rest is Copyright © 2002‒2014 The MirOS Project, Germany.
This product includes material provided by Thorsten Glaser.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.