Krzysztof Żelechowski wrote: > The text of pwd and the value of $PWD return a cached value, > regardless of the actual current path. > mkdir '-p' 'a' && cd 'a' && mv '../a' '../b' && enable '-n' 'pwd' && > builtin 'pwd' && pwd > > Fix: > cd '-P' '.'
That is just the way that things are. The logical path used to get to someplace isn't canonical. There may be multiple logical paths that point to a location. You can only cache the logical value. If the physical path changes out from under the cached value then they will be out of sync and there isn't any way to avoid it. And your fix of switching to the physical path isn't appropriate when a user is requesting logical paths. This is a user configurable setting. If you want canonical paths that are always correct you should use physical paths. The ~/.bashrc file would be an appropriate place to place that setting. set -o physical Bob