From: Jonathan M Lennox (jml12@cunixa.cc.columbia.edu)
Date: 09/09/92


From: jml12@cunixa.cc.columbia.edu (Jonathan M Lennox)
Subject: Re: Binary locations
Date: 9 Sep 1992 05:13:09 GMT

In article <y#sn22#.genie@netcom.com> genie@netcom.com (The Genie) writes:
>
>Hi Linuxers.
>
>I've been using Linux for about 2 weeks now, and have found
>a small nit-picky problem. When I compile something
>or move a executable binary into a directory, Linux refuses
>to recognize the existence of the binary unless
>1) I source my .cshrc which includes paths
>2) The new binary must be located in the binary path.
>
>Is there a way for Linux to automatically recognize binaries
>and execute them in any directory besides those listed
>in the path + to recognize a new binary when placed in
>a directory (in essence, I have to source the .cshrc to
>tell Linux to check all the paths for all binaries).

  There are two issues here.

  First of all, your second point seems to imply that you do not have
'.' (the current directory) in your path. If you want the shell (this
behavior is governed by your shell, not by Linux itself) to find files
in your current directory, change your .login or .cshrc to reflect
this as you set your path.

  Secondly, C-type shells maintain a hash table of command names, and
do not re-search your path automatically when nothing is found. This
makes for faster error reporting in case of a typo, unlike sh-type
shells, which will search your path in case new files have been added.

  The command "rehash" will update this table. You should do this
whenever you add executable files to anyplace along your path. (I
imagine "set path" also updates this, which is why resourcing your
.cshrc solves your problem.)

  [This question really belongs on (or likely, would be answered by an
FAQ on) one of the general comp.unix.* groups--it really doesn't
belong on comp.os.linux.]

Jonathan Lennox