xref: /titanic_50/usr/src/man/man1/which.1 (revision 1c5bc425cc346c6844d58e1fdd8794e9553dd289)
te
Copyright (c) 2005, Sun Microsystems, Inc.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
WHICH 1 "Mar 30, 2005"
NAME
which - locate a command and display its pathname or alias
SYNOPSIS

which [name]...
DESCRIPTION

which takes a list of names and determines which alias or utility would be executed had these names been given as commands.

For each name operand, if it names an alias the alias is expanded. Otherwise the user's path is searched for a utility name matching name. Aliases are taken from the user's .cshrc file. path is taken from the current shell execution environment.

OPERANDS

The following operand is supported: name

The name of a command to be located.

EXIT STATUS

The following exit values are returned: 0

Successful completion.

>0

One or more name operands were not located or an error occurred.

FILES
~/.cshrc

source of aliases and path values

SEE ALSO

csh(1), attributes(5)

DIAGNOSTICS

A diagnostic is given for names which are aliased to more than a single word, or if an executable file with the argument name was not found in the path.

NOTES

The which utility is not a shell built-in command.

BUGS

To compensate for ~/.cshrc files in which aliases depend upon the prompt variable being set, which sets this variable to NULL. If the ~/.cshrc produces output or prompts for input when prompt is set, which can produce some strange results.