'\" te .\" Copyright (c) 2005, Sun Microsystems, Inc. .TH which 1 "30 Mar 2005" "SunOS 5.11" "User Commands" .SH NAME which \- locate a command and display its pathname or alias .SH SYNOPSIS .LP .nf \fBwhich\fR [\fIname\fR]... .fi .SH DESCRIPTION .sp .LP \fBwhich\fR takes a list of names and determines which alias or utility would be executed had these names been given as commands. .sp .LP For each \fIname\fR operand, if it names an alias the alias is expanded. Otherwise the user's path is searched for a utility name matching \fIname\fR. Aliases are taken from the user's \fB\&.cshrc\fR file. \fIpath\fR is taken from the current shell execution environment. .SH OPERANDS .sp .LP The following operand is supported: .sp .ne 2 .mk .na \fB\fIname\fR\fR .ad .RS 8n .rt The name of a command to be located. .RE .SH EXIT STATUS .sp .LP The following exit values are returned: .sp .ne 2 .mk .na \fB\fB0\fR \fR .ad .RS 7n .rt Successful completion. .RE .sp .ne 2 .mk .na \fB\fB>0\fR \fR .ad .RS 7n .rt One or more \fIname\fR operands were not located or an error occurred. .RE .SH FILES .sp .ne 2 .mk .na \fB\fB~/.cshrc\fR\fR .ad .RS 12n .rt source of aliases and path values .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Availabilitysystem/core-os .TE .SH SEE ALSO .sp .LP \fBcsh\fR(1), \fBattributes\fR(5) .SH DIAGNOSTICS .sp .LP 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. .SH NOTES .sp .LP The \fBwhich\fR utility is not a shell built-in command. .SH BUGS .sp .LP To compensate for \fB~/.cshrc\fR files in which aliases depend upon the \fBprompt\fR variable being set, \fBwhich\fR sets this variable to \fBNULL.\fR If the \fB~/.cshrc\fR produces output or prompts for input when \fBprompt\fR is set, \fBwhich\fR can produce some strange results.