Odd Path issue
I'm using bash. "echo $PATH" reports:
~/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
I've written a short script, named "test", and put it in my
"/home/westk/bin" directory. The script is:
#!/bin/bash
echo This is a test
I did a "chown +x test". From my home directory (/home/westk), I can run
"test" and I get no output. However, if I specify "bin/test", I get the
expect message ("This is a test"). If I do a "which test", it reports
"/home/westk/bin/test".
This is the first odd behaviour.
A second odd behaviour is as follows:
I renamed the script to "KentTest". Then running "KentTest" from my home
directory prints the expected message. Then I moved the file from
/home/westk/bin to /usr/local/bin, did a "chown root.root
/usr/local/bin/KentTest" and made the perms 755. If I then do a "which
KentTest", it reports the expected "/usr/local/bin/KentTest". However,
if I run "KentTest", I get "bash: /home/westk/bin/KentTest: No such file
or directory". If I log out and then log back in, I can run "KentTest"
and it prints the message as expected.
It's like the system has cached the previous location of where the
executable was, and the cache doesn't get updated when the file is
moved, but does get updated after a log out/in.
This is not critical to me at all, but it is very curious. Any comments?
Kent
Reply to: