Log in

No account? Create an account
Clip Man


Daniel Einspanjer's journal

Data warehousing, ETL, BI, and general hackery

Previous Entry Share Next Entry
Don't listen to bash, it will lie to you!
Clip Man
Remember folks,  if you mv a directory, and there is a bash shell currently in that directory, the bash prompt will not update to reflect the new name until you cd out of the directory and then back in.

I just spend way too long making changes and being frustrated because the changes weren't having any effect.  I was clearing cashes and restarting applications and monitoring log files..  It wasn't until I happened to do a :pwd in vim while editing the file for the umpteenth time that I finally noticed that the file I had been editing was actually in a backup of the folder that I had just made.


Powered by ScribeFire.

  • 1
Use Windows, it would not have let you move the directory if you had an active shell inside it ;-)

I’d say moving a directory or a file while it is opened is a feature, not a bug :). But I guess the lesson here is that copy/move ≠ move/copy. So don’t move a directory when making a backup but instead make a copy (the copy being the backup).

Precisely - I needed to read that twice to be sure I was grokking it, but 'tis dead on.

The reason for all this is that *nix uses inodes for files, so vim is not using the 'file name,' but rather 'tis using the inode to the file. The other cool thing about this is that you can delete files that are in use, and they will actually delete once the last handle is closed - I used to wget Oggs off my server to my laptop, and once I started playing it, delete it. As soon as ogg123 finished, the file would be gone.

  • 1