Unix problem

Jonathan I. Kamens jik at athena.mit.edu
Wed Apr 24 14:37:58 AEST 1991


In article <598 at fciva.FRANKCAP.COM>, dag at fciva.FRANKCAP.COM (Daniel A. Graifer) writes:
|> Some programs, such as sh, will recognize
|> a lone '-' as forcing the end of option processing. Rm doesn't, but
|> recognizes that '-' is not a valid option, and assumes it's a filename so
|> 	rm - -C
|> will work, but give the error message "'-' non-existant".

On a BSD4.3 system:

	% echo > -test
	% rm - -test
	%

On an Ultrix 3.1 system:

	% echo > -test
	% rm - -test
	%

On an A/UX system:

	% echo > -test
	% rm - -test
	%

On an AIX 1.2 system:

	% echo > -test
	% rm - -test
	%

Furthermore, the BSD4.3 and Ultrix rm(1) man pages both mention the '-'
option.  The AIX man page claims that the option is '--' rather than '-'; I
suspect that support for '-' was left in for backward compatibility.  The A/UX
man page doesn't mention '-', but that doesn't surpise me.

The point I'm trying to make, in case you haven't figure it out yet, is that
rm(1) has recognized '-' as a signal for the end of the command arguments for
a *long* time.  In fact, I was under the impression that the original version
of rm snarfed by Berkeley from AT&T had this feature.

If you've got a version of rm that doesn't recognize '-' as an option
signalling the end of command-line options, then either (a) your rm uses '--'
instead of '-', and decided not to support '-', or (b) you've got a really
broken version of rm.

One more thing -- the question of how to remove files whose names start with
'-' is the FIRST question answered in the comp.unix.questions FAQ posting.  It
would be nice if people wouldn't post answers in the comp.unix newsgroups
without first reading and being familiar with the contents of the FAQ posting.
I wouldn't post this flame to the net if it weren't for the fact that I'm
already posting to the net to correct a mistake, but now that I'm posting on
the subject, I figured I might as well mention the FAQ.  The instructions
appended to the end of this message explain how to get a copy of the FAQ.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710
-- 
        Subject: Frequently Asked Questions about Unix - with Answers [Monthly posting]
        Newsgroups: comp.unix.questions

        Available via anonymous ftp from pit-manager.mit.edu (18.72.1.58)
        in the file

        /pub/usenet/comp.unix.questions/Frequently_Asked_Questions_about_Unix_-_with_Answers_[Monthly_posting]

        Available from mail-server at pit-manager.mit.edu by sending a message
        containing

        send usenet/comp.unix.questions/Frequently_Asked_Questions_about_Unix_-_with_Answers_[Monthly_posting]

        Send a message containing "help" to get general information about the
        mail server.



More information about the Comp.unix.misc mailing list