What ever happened to the rehash command? Is there some other command to tell bash to refresh its cache?
Here's my problem:
Several times in the last year or so, I've been developing a script over time, in bash/python/perl/etc. I use some directory to develop it, so I don't have a cluttered view when I list the files.
Eventually I decide it's working well enough to put into the mainstream, and will work on multiple machines. So I move it into a shared NFS-mounted directory so it's accessible by most of my machines, physical and virtual.
Key info: both the original directory I was developing in, and the shared directory, are in the path. Obviously, I've modified my path in /etc/profile and tacked on some stuff to the end of my path.
I was cooking up a script- to grab status of a device. As long as it's in the directory I developed it in and where I ran it dozens of times, all was well. Then I moved it:
# mv thecstat /usr/local/shared/
# thecstat
-bash: /usr/local/bin/dev/thecstat: No such file or directory
Now it won't run, because it's looking in the wrong place. Obviously, it's caching something. Now that it's in the shared directory, I can go to any other machine and run it without a path, since the shared directory is in the path on my of my machines.
Also, if I specify the path, it runs:
# /usr/local/shared/thecstat
Also, I can fix it by logging out and back in, or by doing su - <username> which creates another shell for the user.
After doing any of those things, I can run the thing without specifying the path.
Surely there is some way top tell bash to discard its cache and reload it?
-T