-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Britton Leo Kerin on 1/6/2006 12:10 PM:
> I sometimes forget to run hash -r after sticking something new in my
> path, and get confused.  One thing I've always been hazy on is whether
> there is a way in unix to connect to a 'dir-contents-changed' signal
> or the like, but if so I would much prefer my interactive shells at
> least to automaticly notice new binaries as they show up in $PATH.
> Its especially confusing because the 'which' command, which is the
> first one people learn to find out which binaries they are running.

You could always turn hashing off:
set +h

There is also a feature for re-searching the path when a program
disappears from its hashed location, but that is not quite the same as
your question of adding a program earlier in the PATH than what was hashed:
shopt -s checkhash

As for a "'dir-contents-changed' signal", the ctime (found from calling
stat()) of every directory in the PATH is the POSIX way of detecting
whether a directory has been modified, but bash does not currently cache
or check the ctime of the directories that appear in PATH prior to the
hashed location of a command.  Maybe someone would like to submit a patch
that does that?  If so, it would probably belong to another shopt setting,
since the point of hashing is to avoid extra stat calls.

- --
Life is short - so eat dessert first!

Eric Blake             [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDv9Xh84KuGfSFAYARAgefAJ4uNguLJny63tqdIvjYFaLUQLyVGACgtbsh
dg7+9DBCKg11q/CUfSU2jgc=
=jOO0
-----END PGP SIGNATURE-----


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to