rm command problem
DAve
dave.list at pixelhammer.com
Fri Oct 20 17:11:20 UTC 2006
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
This works for all manner of funky file names. I had done that many
times before, generally from not reading man pages and passing switches
to programs that didn't expect it, or by piping commands incorrectly.
DAve
--
Three years now I've asked Google why they don't have a
logo change for Memorial Day. Why do they choose to do logos
for other non-international holidays, but nothing for
Veterans?
Maybe they forgot who made that choice possible.
More information about the freebsd-questions
mailing list