Hi, > > as "mkdir -p" succeeds if part of the tree is already created, I'd > > expect "rmdir -p" to succeed if part of the tree is already removed. > > test ! -e "$dir" || rmdir -p "$dir"
Sorry, I guess I wasn't clear, and now I see how we misunderstood each other. When I wrongly used the word "succeed" I didn't mean the exit status, I meant to proceed with parent directories and try to erase them too. This time I don't really care about the exit status of rmdir. My expectation is that if "a/b/c" is an empty directory then "rmdir -p a/b/c/d/e" would remove the a/b/c directory, then remove a/b if it's empty, then remove a if it's empty. Currently it fails since a/b/c/d/e doesn't exist and doesn't proceed with checking a/b/c/d, a/b/c and so on... I also found a simpler workaround for my needs than a while loop, namely: mkdir -p "$dir" rmdir -p "$dir" has the same effect as I'd expect `rmdir -p "$dir"' to work. (Well, only if the deepest existing directory is writable, no disc full blah blah blah...) -- Egmont _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
