Skip to main content
13 events
when toggle format what by license comment
Jun 14, 2016 at 5:02 comment added hobbs @G-Man if you do rmdir $(pwd), pwd figures out a logical name for the current directory, for instance /foo/bar/baz, and then rmdir, seeing that path, removes the baz entry from the /foo/bar directory, provided the conditions are met. This makes sense. The command rmdir ., on the other hand, is an instruction to remove the . entry from the current directory, which is neither allowed (it would violate the constraint that every directory has a . entry pointing to itself) nor useful (it wouldn't remove the link you wanted removed).
Jun 13, 2016 at 18:06 comment added Julie Pelletier This has turned up being a really strange useless debate that I really don't care about. I gave a rational reason and a solution to the problem. The POSIX committee probably didn't write down every single justification they had, especially what seems so obvious as they probably expected it to be to others and didn't really care about it all either. They just defined the rules which as I commented could have been handled differently to accommodate the different perceptions.
Jun 13, 2016 at 17:55 comment added Scott - Слава Україні (Cont’d) …  (2) I suspect that Franklin and I are on the same page.  The answer says, “It’s done like that for integrity ….”  When I challenged that, the answerer switched to “It is not a matter of FS integrity but of logical organization.” and then backpedaled even further to “It would have been possible to support it either way but it was an intentional decision not to.”  So I agree that this answer doesn’t really address the why.
Jun 13, 2016 at 17:55 comment added Scott - Слава Україні @JBentley: (1) I’m also puzzled by Franklin Piat’s reference to rm *.  I guess the remark about shell history is a caution that you might accidentally (re-)execute a command from history, in a different context, with disastrous results.  However, by this line of thinking, you should never use commands that are potentially harmful (or you should disable shell history).  … (Cont’d)
Jun 13, 2016 at 17:51 comment added hvd @JBentley Ignoring the rm * since I don't know either where that came from, but by far most of this answer is about the why, the how is only a minor note. That by itself wouldn't necessary be a problem, but I agree with Franklin Piat that that little how part there is looks pretty clearly wrong, there is nothing in this answer that supports the idea that the rationale is anything other than what's in the official rationale, quoted in jlliagre's answer.
Jun 13, 2016 at 13:18 comment added JBentley @FranklinPiat I didn't find your comment particularly useful: 1. Where did the OP use rm *, and what do you mean by shell history? 2. The answer addressed the why part, 3. Care to elaborate?
Jun 13, 2016 at 12:13 comment added Franklin Piat Down voting because: 1. It's a terrible idea to use rm * and similar variant (think shell history) 2. The question is about "why", not about "how". 3. The statement about integrity is false.
Jun 13, 2016 at 9:13 comment added Julie Pelletier @Emmanuel: This has been decided decades ago and I'm sure they had many good reasons including the one I gave and jlliagre's explanation. It would have been possible to support it either way but it was an intentional decision not to.
Jun 13, 2016 at 8:09 comment added Emmanuel I'm afraid it looks conjectural.
Jun 13, 2016 at 7:18 comment added Julie Pelletier It is not a matter of FS integrity but of logical organization. When you chose your current directory, you tell the shell to use this directory for your upcoming operations, but you can not remove something from itself.
Jun 13, 2016 at 7:08 comment added G-Man Says 'Reinstate Monica' But why/how does the hypothetical rmdir . command compromise file system integrity in a way that rmdir $(pwd) or rmdir "$PWD" does not?
Jun 13, 2016 at 6:56 vote accept JobHunter69
Jun 13, 2016 at 18:12
Jun 13, 2016 at 6:32 history answered Julie Pelletier CC BY-SA 3.0