Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!decvax!mcnc!rti!xyzzy!goudreau From: goudreau@xyzzy.UUCP (Bob Goudreau) Newsgroups: comp.unix.wizards Subject: Re: an rm question Message-ID: <793@xyzzy.UUCP> Date: 18 Apr 88 05:05:20 GMT References: <27133@yale-celray.yale.UUCP> <670012@hpclscu.HP.COM> Reply-To: goudreau@rtp48.UUCP (Bob Goudreau) Organization: Data General Corporation, Research Triangle Park, NC Lines: 21 In article <670012@hpclscu.HP.COM> shankar@hpclscu.HP.COM (Shankar Unni) writes: >We had the same problem frequently when people would create files called, >for instance "-b", and rm would choke (-b: illegal option!). The solution >was (a) rm -- -b (the -- terminates the option list, IN MANY IMPLEMENTATIONS), >or (b) rm nonexistentfile -b or (c) /etc/unlink -b (for superusers only). The problems with these solutions are: (a) is non-portable; (b) is a kludge; and (c) is just unnecessarily harsh on your file system. A cleaner and more general solution to this problem can be had by simply thinking about the names by which a given file can be referenced. That's right, "names" not "name". In particular, "./-b" will always do the trick. There are an infinitude of other ways to refer to the offending file that don't begin with "-", such as "/usr/foo/-b" (or whatever one of its full pathnames may be), or "../foo/-b", or "././-b" or .... -- Bob Goudreau Data General Corp., 62 Alexander Drive, Research Triangle Park, NC 27709 (919) 248-6231 {ihnp4, seismo, etc.}!mcnc!rti!xyzzy!goudreau goudreau@dg-rtp.dg.com