Re: [ILUG] binaries on the path... not! (yet)

From: Caolan McNamara (Caolan.McNamara at domain ul.ie)
Date: Mon 13 Sep 1999 - 11:34:33 IST


On 13-Sep-99 Vincent Cunniffe wrote:
>ilug-admin at domain linux.ie wrote:
>>
>> Ok. I install Linux with basic networking, no frills. I test the
>> networking... ping works ok. Telnet... hah, forgot to install. Find the
>> rpm, install it.
>>
>> #:telnet 192.168.0.123
>> telnet: Command not found.
>> #:/usr/bin/telnet 192.168.0.123
>> Contacting 192.168.0.123....
>> ^C (Grrrr!!!!)
>>
>> Logout. Login. Telnet. No problem. Except for bad memories of "Windows
>> has finished upgrading your software. Would you like to restart windows
>> now? [Yes] [Yes]"
>>
>> It's obvious (sticking my neck out?) that Linux (or just tcsh?) is
>> caching the binaries on the path. Can I refresh this somehow _without_
>> losing my precious command history?
>

tcsh *does* cache the location of binaries. It does not cache the binaries
themselves, but it does do the locations. So you are correct in that
when you installed a new binary that you had to explicitly put in the full path
to the new installed binary to get it to be noticed by tcsh. I suspect that is
not a 100% clear cut thing, but it does occur. As soon as the path variable is
set (or reset) then the cache is updated. What I have in my .tcshrc is an
alias named resource i.e.

alias resource 'source ~/.tcshrc'

which reruns my .tcshrc, which resets the path which updates the binary location
path.

bash on the other hand is a little better, for instance
bash >
a.out
bash: a.out: command not found
(copy a file name a.out into /usr/local/bin)
bash: a.out
hi

so bash will find a new binary added in, on the other hand if the a.out is now
moved into a different bin dir bash wont be able to let go of the idea that
a.out should be somewhere else. So basically if bash does not know of the
location of a binary it will look for it, once it has the location fixed in its
mine, it wont search for it again. tcsh on the other hand won't search for a new
binary if it wasnt in the path when set path was run. In both cases you can get
the shell to resync if you set the path variable again.

I imagine that this behavior allow huge speed ups in finding binaries to run in
the usual case. Its not a linux thing, but specific behaviour of the shell
program itself. various shells have different behaviour. If you were running
bash when you installed the telnet daemon it would have done what you expected
when you typed telnet. This obviously has nothing to do with telnet itself, or
any other area of linux whatsoever.

C.

Real Life: Caolan McNamara * Doing: MSc in HCI
Work: Caolan.McNamara at domain ul.ie * Phone: +353-86-8790257
URL: http://www.csn.ul.ie/~caolan * Sig: an oblique strategy
Always first steps



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:04:33 GMT