Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Oct 2006 14:15:28 -0400
From:      Jonathan Arnold <jdarnold@buddydog.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: rm command problem
Message-ID:  <ehb3o0$kvq$1@sea.gmane.org>
In-Reply-To: <45390333.4020007@pixelhammer.com>
References:  <20061020162119.49001.qmail@web25221.mail.ukl.yahoo.com> <45390333.4020007@pixelhammer.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ehb3o0$kvq$1>