[net.unix-wizards] Automatic Csh rehashing?

ado@elsie.UUCP (06/12/84)

"Csh" does hashing to cut down on the number of directories that get searched
when you ask for a command to be executed.  If you add a command to a directory
in your path after the hash table is created, you get to use the built-in
	rehash
command to ensure that Csh is able to find the added command.

I'm thinking that rehashing by hand can be avoided if,
when "Csh" gets to a place where it produces a
	Command not found
diagnostic, it automatically does a rehash and tries to find the command a
second time.  (Yes, this does slows down production of the diagnostic
when the command REALLY is missing.  Would "set noautorehash" calm gurus? :-))

Any reactions?  Has anyone done this for 4.1 bsd?  Does it show up in 4.2?
Tap that 'r' key and mail me your reply.  Thanks.
--
UNIX is an AT&T Bell Laboratories trademark.
--
	...decvax!allegra!umcp-cs!elsie!ado	(301) 496-5688

chris@umcp-cs.UUCP (06/12/84)

Actually, simply logging in on a loaded system can be quite a pain
when the C shell goes to hash $path.  I've occasionally logged in
and had to wait 5 minutes or more before the ``set path'' completed.
(I have my .cshrc set up to print ``['' as it starts, and ``cshrc]''
after the ``set path''; that's how I know how long it takes.)

Here's my counter-proposal:  don't initialize the hash list all at
once.  Instead, every time a command works (except for those in
``.'' of course), put *that* in the list.  Voila!  No ``rehash''
required (unless you just installed /usr/local/bin/make and want
to get that instead of /usr/bin/make), and no initial startup
delays.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci (301) 454-7690
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland

zemon@felix.UUCP (06/19/84)

I don't think the C-shell should automatically rehash.
I rarely add new commands to the path (once every couple
of weeks, maybe).  This means that commands not found are
almost always *really* not there.  I don't want to wait
for a rehash.

A variable which can be set might be OK but I don't particularly
like that solution.

    -- Art Z.