*BSD News Article 5423


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!goanna!minyos.xx.rmit.oz.au!s902113
From: s902113@minyos.xx.rmit.oz.au (Luke Mewburn)
Newsgroups: comp.unix.bsd
Subject: Re: binaries are unavailable when moved to /usr/bin until re-logon
Message-ID: <1992Sep22.220933.24164@minyos.xx.rmit.oz.au>
Date: 23 Sep 92 03:09:33 GMT
References: <1992Sep21.175158.25399@Saigon.COM>
Organization: RMIT Computer Centre, Melbourne Australia.
Lines: 28

David.Fox@Saigon.COM writes:

>After doing a few rounds of getting source-code to something, compiling it,
>building the binary of it, and then moving it into its proper place (usr/
>bin, or /usr/local/bin) I've noticed that when I attempt to run the command
>once it has been moved - even though it certainly is in the path - that 
>the system responds with "Command not found."  However, when I relogon, the
>file now is accessible.

>Coming from a DOS world, I'm used to having the commands available immediately
>after they've been moved, assuming of course, the directory they are moved to
>is in the path.

>This doesn't seem to be the case with 386BSD.  Question: is this expected
>behavior?

    Some of the shells (notably csh and tcsh, and maybe bash) cache the
list of filenames in your path with a hash table. This makes lookup of
files faster (unlike DOS where it searches the path at each command
you type). When you add a file to a path, and you wish to notify
csh/tcsh (and maybe bash - I dunno - I don't use it :) of this, type
 rehash
This regenerates the hashlist for the shell, and so the shell will
recognise the files. BTW: I think that the directory '.' gets
automagically updated, as I don't have to do rehash whenever I
modify/add files in the current directory.
    This rehash has to be done on any version of unix using a shell
with this characteristic...