From owner-freebsd-questions Tue Nov 24 00:34:08 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA22747 for freebsd-questions-outgoing; Tue, 24 Nov 1998 00:34:08 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from post.mail.demon.net (post-20.mail.demon.net [194.217.242.27]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA22742 for ; Tue, 24 Nov 1998 00:34:06 -0800 (PST) (envelope-from marko@uk.radan.com) Received: from [158.152.75.22] (helo=uk.radan.com) by post.mail.demon.net with smtp (Exim 2.053 #1) id 0ziDv7-0001DY-00; Tue, 24 Nov 1998 08:34:02 +0000 Organisation: Radan Computational Ltd., Bath, UK. Phone: +44-1225-320320 Fax: +44-1225-320311 Received: from beavis.uk.radan.com (beavis [193.114.228.122]) by uk.radan.com (8.6.10/8.6.10) with SMTP id IAA01628; Tue, 24 Nov 1998 08:33:30 GMT Received: from uk.radan.com (gppsun4) by beavis.uk.radan.com (4.1/SMI-4.1) id AA02536; Tue, 24 Nov 98 08:33:28 GMT Message-Id: <365A6F2C.C114F38@uk.radan.com> Date: Tue, 24 Nov 1998 08:32:44 +0000 From: Mark Ovens Organization: Radan Computational Ltd X-Mailer: Mozilla 4.03 [en] (X11; I; SunOS 4.1.3_U1 sun4m) Mime-Version: 1.0 To: Anand Buddhdev Cc: "Leonard C." , questions@FreeBSD.ORG Subject: Re: How to delete files starting with "-"? References: <19981124111248.B11637@iconnect.co.ke> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Anand Buddhdev wrote: > > On Tue, Nov 24, 1998 at 12:12:25AM -0800, Leonard C. wrote: > > > I accidentally created a file starting with a dash, and can't seem to > > delete it. mv, cp, and rm all interpret the dash as an argument. > > > > If "-foo" is the name of the file, I've tried "-foo", '-foo', and \-foo, > > but none of them work since these just affect the shell rather than the > > actual parsing of the command itself. Any ideas? This is driving me > > *absolutely* crazy! > > rm ./-foo > > The dot-slash causes the shell not to treat the hyphen specially. funnily > though, > Because ``./-foo'' is a single string and therefore ``-'' is not the first character. ``-'' only has a special meaning at the start of an argument, i.e. options. > rm '-foo' should also work, It won't. The shell will strip the quotes so ``rm'' gets ``-foo'' as an argument which, because it starts with ``-'', it tries to parse as options with no filename, i.e. the same as typing ``rm -f -o -o''. There is no ``o'' option to rm and you must specify one or more filename(s). > unless the permissions on the file do not allow > you to delete it. If rm ./-foo does not work, then you should look at the > permission on the file. That may be where your problem lies. > > -- > Anand > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- Trust the computer industry to shorten Year 2000 to Y2K. It was this thinking that caused the problem in the first place. Mark Ovens, CNC Applications Engineer, Radan Computational Ltd. Bath, Avon, England. Sheet Metal CAD/CAM Solutions mailto:marko@uk.radan.com http://www.radan.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message