Bug 115183

Summary: Can't delete certain files
Product: Base System Reporter: John S. Strock <jstrock>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description John S. Strock 2007-08-03 22:30:04 UTC
I can create files with a leading hyphens, for example "-r" or "-rabbit", by either copying a file (i.e. "cp testfile -r") or opening vi and and then saving with the filename "-r".  But I can't delete these files.  Each command I use think's the "-r" is an option rather than a file so I get an error.

Fix: 

The folder that has the hyphenated filenames can be deleted, but I'm not sure how to delete the filenames directly (i.e you don't want to delete the folder, just the file).
How-To-Repeat: Create a file with a leading hyphen either one of two ways (that I've tried anyway).

1) Starting vi, then saving the file with a leading hyphen.  i.e. "-rabbit".

2) Copy another file.  i.e. "cp myfile -rabbit"
Comment 1 Remko Lodder freebsd_committer freebsd_triage 2007-08-03 22:39:39 UTC
Hello,

The solution might be to use rm ./-rabbit in the directory containing
the 'offending file'. This most often works with files like this.

Note that this is not a PR ticket worth, but a general support question,
i will close the PR in question. Please consider using
http://lists.freebsd.org/mailman/listinfo/freebsd-questions/ the next
time you have a question like this.

Thanks for using FreeBSD though!

Cheers
remko
-- 
Kind regards,

     Remko Lodder               ** remko@elvandar.org
     FreeBSD                    ** remko@FreeBSD.org

     /* Quis custodiet ipsos custodes */
Comment 2 Remko Lodder freebsd_committer freebsd_triage 2007-08-03 22:40:39 UTC
State Changed
From-To: open->closed

This is a general support question, which can be solved if you read my 
follow-up. Closing the ticket