[Top][All Lists]

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

Re: rm - bug or user error?

From: Michael Webb
Subject: Re: rm - bug or user error?
Date: Tue, 26 Jan 2010 18:35:36 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv: Gecko/20090823 SeaMonkey/1.1.18

All I can say is wow! You guys are either really good or really bored :-) Maybe both!

Thanks for all of the comments, suggestions and discussion. A lot of people around here use ksh or bash. It would probably be worthwhile making the switch--not specifically for this, but for all of the other reason you mentioned as well as some cool features like function calling. I've used csh for 15 years--an old dog, I guess.

Thanks again,

Eric Blake wrote:
According to Jon Stanley on 1/26/2010 7:05 PM:
On Tue, Jan 26, 2010 at 8:57 PM, Michael Webb <address@hidden> wrote:

I'm running /bin/csh.  Don't know how to figure out the coreutil version,
however the rm man-page says 5.2.1.

Wow, that's old.  The latest stable version is 8.4, and includes several
fixes for rm (although I think we've already established that this was
your shell, and not rm).

Yeah, like Eric said, I think that this is a csh problem rather than a
coreutils problem. I would even think that csh is behaving wrongly
here - rather than refusing to run rm because the glob didn't match,
it should pass the f* straight through to rm to deal with as it
pleases, unless you explicitly told the shell to fail (as Eric did in
his example). I don't have any standards to back that up though, Eric
is the POSIX-citing guy around here :)

csh is not specified by any standards.  It's personal choice whether you
use it instead of sh (but personally, I _hate_ csh variants, because they
are so impossible to use for any decent scripting, and so woefully

My guess is that bash originally provided the failglob option to make it
easier for people switching from tcsh to bash to still keep the default
behavior of csh.  'man tcsh' states:

| It is an error for a glob‐pattern containing ‘*’, ‘?’, ‘[’ or ‘~’, with
| or without ‘^’, not to match any files.

It also looks like tcsh provides the nonomatch shell variable to make tcsh
take on the somewhat more POSIX-like behavior of passing unmatched globs

Any standards for that Eric?

Bash's '-s failglob' is an extension allowed by POSIX, but as an
extension, it is not standardized.  The moment you use an extension, then
the shell is within its right to use an alternate behavior (in this case,
failing when a glob doesn't expand, rather than calling the app with a
literal argument of "f*").  So I see nothing in the above example that
conflicts with the standards; although a strictly compliant app wouldn't
have been using either csh or failglob in the first place.

reply via email to

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