Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!rutgers!pyrnj!romain
From: romain@pyrnj.uucp (Romain Kang)
Newsgroups: comp.unix.questions
Subject: Re: $PATH glitch? -- Gould Powernode
Message-ID: <635@pyrnj.uucp>
Date: Sat, 25-Jul-87 17:00:31 EDT
Article-I.D.: pyrnj.635
Posted: Sat Jul 25 17:00:31 1987
Date-Received: Sun, 26-Jul-87 02:19:34 EDT
References: <155@dsacng1.UUCP>
Reply-To: romain@pyrnj.UUCP (Romain Kang)
Organization: Pyramid Technology Corp, Woodbridge, NJ
Lines: 35
Keywords: PATH shell environment
Summary: rehash

I'll probably be the 48nd person to answer, but...

In article <155@dsacng1.UUCP> naa1810@dsacng1.UUCP (Bill Bereza) writes:
| After I signed on the system in the C Shell ...
 ...
| I further experimented and found out that I could not execute a
| new shell script that I created in my bin directory from any directory
| path except when my cwd was my bin directory.

| I also noted that when I logged off and then back on, all my bin
| shell scripts would properly execute from any cwd.

This is because csh builds a hashed list of commands and their full
path names when it starts up, based on the path (or PATH) variable.
The current directory is not subject to this hash table, since it
would be expensive to rebuild the table each time a user changed
directories.  (I cut my Unix teeth on a PDP-11/34 with RL01's,
and I can still remember how the system paused when someone started
a new csh -- but I digress...)

A sensible compromise for a shell designer (living on small PDPs)
would be to have the user explicitly rebuild the hash table when
a command was added to the path.  This is done with the csh "rehash"
command.  As they say, "It's a FEATURE!!!"

The SVr2 sh and ksh have other hashing strategies that deal with
changed paths, which in fact handle your case without any special
rehash-style commands, while the old V7 sh tries to exec every possible
pathname until it succeeds by brute force.  (Imagine that on a slow
CPU with slow disks...)
--
Romain Kang		{allegra,cmcl2,mirror,pyramid,rutgers}!pyrnj!romain

''!!!x89 dimaryP a fo edisni deppart m'I  !pleH``
``oNhwre eenraa  sab dsab iegnt arppdei  n aDP-P113/!4!!''