From owner-freebsd-questions@FreeBSD.ORG Fri Oct 20 18:16:24 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 05F1F16A415 for ; Fri, 20 Oct 2006 18:16:24 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7EEAD43D76 for ; Fri, 20 Oct 2006 18:16:22 +0000 (GMT) (envelope-from freebsd-questions@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GayuZ-0003jw-DN for freebsd-questions@freebsd.org; Fri, 20 Oct 2006 20:16:05 +0200 Received: from c-24-147-85-158.hsd1.ma.comcast.net ([24.147.85.158]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 20 Oct 2006 20:16:03 +0200 Received: from jdarnold by c-24-147-85-158.hsd1.ma.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 20 Oct 2006 20:16:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: Jonathan Arnold Date: Fri, 20 Oct 2006 14:15:28 -0400 Lines: 43 Message-ID: References: <20061020162119.49001.qmail@web25221.mail.ukl.yahoo.com> <45390333.4020007@pixelhammer.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: c-24-147-85-158.hsd1.ma.comcast.net User-Agent: Thunderbird 1.5.0.5 (X11/20060804) In-Reply-To: <45390333.4020007@pixelhammer.com> Sender: news Subject: Re: rm command problem X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Oct 2006 18:16:24 -0000 DAve wrote: > Efren Bravo wrote: >> Hi, >> >> Accidentally I've created a file called -exclude >> and now I cann't delete it. >> >> I tried with: >> >> rm -exclude and rm *exclude but it returns this: >> >> rm: illegal option -- - >> usage: rm [-f | -i] [-dIPRrvW] file ... >> unlink file >> >> How can I delete it? > > You have probably found that anything you try errors because the shell > thinks -e is a switch. The easiest way is to find the files inode number > and delete the file using that. > > director# ls -i > 107008 .bash_history 107760 .login 107759 .mail_aliases > 107764 .profile 107765 .shrc > 107758 .cshrc 107761 .login_conf 107762 .mailrc 107763 > .rhosts > > then use find to remove the file. > > director# find . -inum 107763 -exec rm -i {} \; > remove ./.rhosts? y Well, that was fun! I was wondering just how many different ways people could come up with deleting the file, but this one has to be crowned the winner of the all important "Most Obscure Solution" :-) To delete something based upon the inode - fantastic! -- Jonathan Arnold (mailto:jdarnold@buddydog.org) Daemon Dancing in the Dark, a FreeBSD weblog: http://freebsd.amazingdev.com/blog/ UNIX is user-friendly. It's just a bit picky about who its friends are.