Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Feb 1998 16:11:59 -0500 (EST)
From:      Brian Clapper <bmc@WillsCreek.COM>
To:        "Joe \"Marcus\" Clarke" <marcus@miami.edu>
Cc:        "Matthew D. Fuller" <fullermd@futuresouth.com>, laszlo vagner <kf7nn@mutsgo.dyn.ml.org>, Greg Lehey <grog@lemis.com>, questions@FreeBSD.ORG
Subject:   Re: rehash missing
Message-ID:  <199802012111.QAA05678@current.willscreek.com>
In-Reply-To: <Pine.OSF.3.96.980201050915.1311B-100000@jaguar.ir.miami.edu>
References:  <Pine.BSF.3.96.980201034222.21493B-100000@shell.futuresouth.com> <Pine.OSF.3.96.980201050915.1311B-100000@jaguar.ir.miami.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On 1 February, 1998, at 05:09 (-0500)
"Joe \"Marcus\" Clarke" <marcus@miami.edu> wrote:

> A quick way to find out if a command is built into the shell or not, is
> to run 'which <command>'.  It will tell you right waway.

Note that `which' won't tell you the command is a built-in unless you use
`csh' or `tcsh', where `which' itself is a built-in.  In a shell for which
there is no `which' built-in (e.g., `ksh'), you'll end up running
`/usr/bin/which', and that "outside" command cannot possibly know about the
shell's built-in commands or its currently-established aliases.  Try typing

        which alias

inside `ksh'.  You'll get no output.  However, for most of the shells
supported by FreeBSD, there is typically a built-in command that
corresponds to `which'.  For example:

---------------------------------------------------------------------------
SHELL           COMMAND
---------------------------------------------------------------------------
tcsh            which

csh             which

sh              type

ksh             whence -v
                type  (which is nothing more than an alias for `whence -v'

bash            type

zsh             type
                which
                whence -v
---------------------------------------------------------------------------

Brian Clapper, bmc@WillsCreek.COM, http://WWW.WillsCreek.COM/
You should emulate your heros, but don't carry it too far.  Especially
if they are dead.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802012111.QAA05678>