[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rmdir -p foo/bar/nonexistent

From: Paul Eggert
Subject: Re: rmdir -p foo/bar/nonexistent
Date: Mon, 10 Apr 2006 11:28:27 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Koblinger Egmont <address@hidden> writes:

> 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.

That's a natural expectation, but it disagrees with common practice
(e.g., Solaris 10).  POSIX isn't 100% clear on this point but I think
the intent is to do as Solaris and coreutils do.

You can work around most of the problem in a script as follows:

test ! -e "$dir" || rmdir -p "$dir"

If there's a real need for an option that works the way you suggest, I
suppose it could be added; but it shouldn't be called "-p".

reply via email to

[Prev in Thread] Current Thread [Next in Thread]