'mv foo ..' when . is foo

Mark Rosenthal mbr at aoa.UUCP
Fri Aug 23 09:24:25 AEST 1985


Although our site has been receiving articles for the past few months,
articles posted to the net have not been getting distributed until recently.
The following is a reposting of an article I sent out quite some time ago.
I believe it never made it to the net at large.  Apologies if you have seen
this before.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I just did the following by accident:

	mkdir foo		# Make a temporary directory
	cd foo
	 .
	 .
	 .
	<lots of editing>
	 .
	 .	# Time passes.  I forget what directory I'm in.
	 .	# I need a temporary file name.  How about 'foo'.
	 .
	<create file foo>
	 .
	 .	# More time passes.  Lets save foo where it'll
	 .	# be safe when I delete my current directory.
	 .
	mv foo ..
	 .
	 .	# Now, what's the name of my current directory?
	 .
	pwd	# This produces "pwd: read error in .."

Is this a feature?

BTW, I was logged in as root at the time.  It turns out that it doesn't
work this way if you're not.  We are running a port of Sys V on the
Masscomp MC500.

-- 

	Mark of the Valley of Roses
	...!{decvax,linus,ima,ihnp4}!bbncca!aoa!mbr



More information about the Comp.unix.wizards mailing list