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


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 <[EMAIL PROTECTED]> * UNIX is a lever for the
http://www.pobox.com/~mph/           * intellect. -J.R. Mashey

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to