‘cd ..’, ‘cd ./
‘ when updating directories in Max OS X.
So a strange thing happened while doing some coding in symfony2. At first i thought it was symfony2, but realised i was using the wrong version, so no problem. I got the latest version, renamed the old one by appending an underscore and put the updated one in the same place with the name of the old directory.
So ‘symfony’ became ‘symfony_’ then the new folder could be called ‘symfony’ without getting an error about trying to name a directory the same as an existing one. This part was done in the finder.
No problem’o, now when i try to use the command line, which might i mention was already being used prior to shuffling the directories and i try to do ‘pwd’ it tells me i am in ‘symfony’. Great, however i still get the same errors as before, which i thought odd. When i did ‘cd ..’ then ‘cd symfony’, it fixed it, even though prior to that ‘pwd’ told me i was in the symfony folder, in reality, the command line thought i was in the now defunct directory ‘symfony_’.
So it seems when renaming a directory to put another of the same name in its place, if the command line was already ‘cd’d’ in there, then it will still point to the old directory regardless of the change of name. And to resolve this, you need to cd back then forward again.
I am just guessing here, but perhaps the cmd points to nodes on the filesystem and thusly does not care much about the directory name.
Not sure if this is a mac issue or a inherent problem with the unix/posix standard. Interesting and annoying though non-the-less.