From owner-freebsd-questions Fri Dec 1 14:58:12 2000 Delivered-To: freebsd-questions@freebsd.org Received: from joe.pythonvideo.com (joe.pythonvideo.com [209.226.29.94]) by hub.freebsd.org (Postfix) with ESMTP id 980B837B400 for ; Fri, 1 Dec 2000 14:58:08 -0800 (PST) Received: from localhost (joe@localhost) by joe.pythonvideo.com (8.11.1/8.11.0) with ESMTP id eB1MvsO18118; Fri, 1 Dec 2000 17:57:54 -0500 (EST) (envelope-from joe@advancewebhosting.com) X-Authentication-Warning: joe.pythonvideo.com: joe owned process doing -bs Date: Fri, 1 Dec 2000 17:57:54 -0500 (EST) From: Joe Oliveiro X-Sender: joe@joe.pythonvideo.com To: Mike Meyer Cc: Larry Rosenman , Daniel.Bye@uk.uu.net, questions@FreeBSD.ORG Subject: Re: Pesky file In-Reply-To: <14888.10802.824157.322136@guru.mired.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Usually the rm -rf "foo" works for trival filename for me, but i will recheck things before i post answers! FreeBSD - The BEST upgrade you can do to NT! On Fri, 1 Dec 2000, Mike Meyer wrote: > Joe Oliveiro types: > > rm -rf "-help" > > > > will remove the file > > Did you try it before posting? Here's what happened when I tried it: > > guru$ touch ./-help > guru$ rm -rf "-help" > rm: illegal option -- h > usage: rm [-f | -i] [-dPRrvW] file ... > unlink file > guru$ > > And it's the same reason as before - the leading '-' gets seen by rm > as an options indicator, and then 'h' is an illegal option. To remove > a file with a leading '-', you have to either hide the leading '-' > (which is what ./-help does), or convince rm to not look for options > (which is what '--' does). > > > > FreeBSD - The BEST upgrade you can do to NT! > > > > On Fri, 1 Dec 2000, Mike Meyer wrote: > > > > > Larry Rosenman types: > > > > * Daniel Bye [001201 05:21]: > > > > > Hi all, > > > > > > > > > > Here's a question for a Friday morning... Somehow, I have ended up with a > > > > > file named -help in my home directory. How can I get rid of it? It is 0 > > > > > bytes, > > > > > and if I try to rm, mv, unlink it etc, the shell interprets the file name as > > > > > an > > > > > argument to the program and spews forth errors. Backslash escaping it > > > > > doesn't work, and neither does quoting it. > > > > rm -- -help > > > > > > > > or rm -i ?help > > > > > > That won't work any more than "rm *help" would. The problem with both > > > of them is that the shell expands the metacharacters, so that rm sees > > > the "-" first, so thinks it's an argument. > > > > > > Just FWIW, if you happen to be on a system that doesn't recognize the > > > "--" convention (or need to run a command that doesn't), you can > > > always do "rm ./-help". > > > > > > Trivia question: what two bytes can you *not* put in a Unix filename? > > > > > > > > -- > > > Mike Meyer http://www.mired.org/home/mwm/ > > > Independent WWW/Unix/FreeBSD consultant, email for more information. > > > > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > > with "unsubscribe freebsd-questions" in the body of the message > > > > > > > > -- > Mike Meyer http://www.mired.org/home/mwm/ > Independent WWW/Unix/FreeBSD consultant, email for more information. > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message