Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Feb 2003 13:06:23 -0800
From:      Matthew Hunt <mph@astro.caltech.edu>
To:        Kent Stewart <kstewart@owt.com>
Cc:        Ruben de Groot <fbsd-q@bzerk.org>, parv <parv_fm@emailgroups.net>, David Banning <david@skytracker.ca>, questions@FreeBSD.ORG
Subject:   Re: how to delete a file called ????
Message-ID:  <20030212210623.GA85508@wopr.caltech.edu>
In-Reply-To: <200302121259.18010.kstewart@owt.com>
References:  <20030212111232.A6759@skytrackercanada.com> <200302121145.33271.kstewart@owt.com> <20030212204251.GA74324@ei.bzerk.org> <200302121259.18010.kstewart@owt.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 12, 2003 at 12:59:18PM -0800, Kent Stewart wrote:

> I had always used the -i to go along with it. I tried it with ??? and 
> abc and a "rm -- ???" deleted both files, which wasn't what I expected 
> if wildcarding was turned off with the "--".

WILDCARD PROCESSING IS NOT TURNED OFF WITH "--".

Sorry for yelling, but every time someone asks about removing a file with
an odd name, wrong notions like this one surface.

In Unix, wildcard processing is handled by the shell, not the program you're
running.  The program you're running gets the wildcard-expanded filenames,
and has no idea whether you used a wildcard or typed them by hand.  (This
explains why "mv *.foo *.bar" does not work the way a DOS user would expect
it to.)

"--" is an option processed by rm, just like "-r" or "-i".  It tells rm
to stop processing further options (i.e. treat arguments that start with "-"
as filenames rather than options.)  It has nothing to do with wildcard
processing, because the wildcards have already been expanded by the time
rm even has a chance to weigh its options.

"--" is the answer to "How do I delete a file called -i" not "How do I
delete a file called ???".  But some people seem to think they're all the
same question.

As I've mentioned before in this thread, it's completely possible that
the file doesn't even have question marks in its name, anyway, because
ls will display unprintable characters as question marks.

-- 
Matthew Hunt <mph@astro.caltech.edu> * UNIX is a lever for the
http://www.pobox.com/~mph/           * intellect. -J.R. Mashey

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030212210623.GA85508>