[comp.unix.questions] csh path

mostek@motcid.UUCP (Frank B. Mostek) (03/09/91)

When I add a new image to a bin directory that is included in my path
csh environment variable, I have to "re-setenv" the path variable in
order for the new image to be found.

Why?  Is there a way around this?  When I add a new tool, I have to
tell everyone to re-source their .cshrc file.  But if I update an image
file, then the re-sourcing is not necessary.
-- 
************************************************************
Frank Mostek			uunet!motcid!amethyst!mostek
Software Consultant 		(708)632-7191
************************************************************

skrbec@motcid.UUCP (Brad Skrbec) (03/09/91)

mostek@motcid.UUCP (Frank B. Mostek) writes:

>When I add a new image to a bin directory that is included in my path
>csh environment variable, I have to "re-setenv" the path variable in
>order for the new image to be found.

>Why?  Is there a way around this?  When I add a new tool, I have to
>tell everyone to re-source their .cshrc file.  But if I update an image
>file, then the re-sourcing is not necessary.
>-- 

I believe the problem you are describing has to do with the path
hash table.  New entries added to directories in the path are
not automatically added to the hash table.  To effect this change,
you can either re-source the your .cshrc (which just re-establishes
your path, thus causing the table to be created), or you can just
type "rehash" at the command line, which creates the table anew.

------------------------------------------------------------------------------
| Brad Skrbec                | "For it is the doom of men that they forget." |
| Motorola Cellular          |                             -- Merlin         |
| Arlington Heights, IL      | UUCP: uunet!motcid!skrbec                     |
|                            | Internet: motcid!skrbec@uunet.uu.net          |
------------------------------------------------------------------------------

tchrist@convex.COM (Tom Christiansen) (03/09/91)

From the keyboard of mostek@motcid.UUCP (Frank B. Mostek):
:When I add a new image to a bin directory that is included in my path
:csh environment variable, I have to "re-setenv" the path variable in
:order for the new image to be found.

You can type:

% rehash

instead of resourcing the .cshrc file.

:Why?  Is there a way around this?  When I add a new tool, I have to
:tell everyone to re-source their .cshrc file.  But if I update an image
:file, then the re-sourcing is not necessary.

To avoid it, don't use csh. :-)

--tom

art@pilikia.pegasus.com (Art Neilson) (03/10/91)

In article <5965@beryl12.UUCP> mostek@motcid.UUCP (Frank B. Mostek) writes:
>When I add a new image to a bin directory that is included in my path
>csh environment variable, I have to "re-setenv" the path variable in
>order for the new image to be found.
>
>Why?  Is there a way around this?  When I add a new tool, I have to
>tell everyone to re-source their .cshrc file.  But if I update an image
>file, then the re-sourcing is not necessary.

The C shell keeps an internal hash table for finding commands in your $path.
This table is built when you log in, if you add a new executable to a
directory in the path you need you tell the C shell to rebuild it's hash
table.  The easiest way of doing this is via the 'rehash' command.  At the
% prompt, just type 'rehash', and csh will be able to find the new
executables in the path.  Alternatively, you can log out and back in again,
or "re-setenv" the path variable as you have been doing.

-- 
Arthur W. Neilson III		| INET: art@pilikia.pegasus.com
Bank of Hawaii Tech Support	| UUCP: uunet!ucsd!nosc!pilikia!art