[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: exit status of rm
From: |
Bob Proulx |
Subject: |
Re: exit status of rm |
Date: |
Thu, 23 Jun 2005 23:27:23 -0600 |
User-agent: |
Mutt/1.5.9i |
Jim Meyering wrote:
> address@hidden (James Youngman) wrote:
> > On Thu, Jun 23, 2005 at 08:45:05PM +0000, Eric Blake wrote:
> >> This puts the invocation of rm without arguments in the
> >> implementation's realm, where currently, coreutils is not consistent
> >> on what it returns:
Without belaboring consistency I believe it is doing exactly the right
thing to do.
> >> $ rm
> >> rm: missing operand
> >> Try `rm --help' for more information.
> >> $ echo $? # used improperly
> >> 1
> >> $ rm -f
> >> $ echo $? # all (zero) calls to unlink succeeded
> >> 0
> >
> > Personally I think this is exactly the right way to do it (both
> > cases).
>
> Same here.
>
> FYI, Solaris' /bin/rm is similar (though it's 2 and 0).
> On NetBSD 1.6 /bin/rm exits with status 1 in both cases.
I know that if this behavior changed it would break a lot of scripts.
It is very common to see variables in the rm -f which may not be
expanded. It is often counted upon that rm -f without arguments will
not be an error. This is very useful behavior.
rm -f $TMPS # where $TMPS might not be set
> >>Are there any systems out there where "rm -f ``" has non-zero status?
Not that I know of and that would include GNU, BSD, HP-UX, IBM AIX, Solaris.
Bob