Xref: utzoo comp.unix.xenix:6006 comp.unix.questions:13633 comp.unix.wizards:16160 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.xenix,comp.unix.questions,comp.unix.wizards Subject: Re: Ugly file name Keywords: rm cat mv regexp Message-ID: <1632@auspex.auspex.com> Date: 16 May 89 17:57:05 GMT References: <128@tdl.UUCP> <7170@bsu-cs.bsu.edu> <1614@auspex.auspex.com> <448@hsi86.hsi.UUCP> Reply-To: guy@auspex.auspex.com (Guy Harris) Distribution: usa Organization: Auspex Systems, Santa Clara Lines: 20 >This doesn't work for filenames that start with a minus. eg -badfile >Anyone know how to erase such files with whipping up a short C program? Yes, I think just about *anybody* reading any of these groups who is familiar with the "unlink" system call can do it trivially. However, there are better ways to remove "-badfile" as well. Both the BSD and S5 versions (S5R3 and later, and least, and, I suspect, S5R2 and maybe earlier as well) have flags to say "nothing after this is a flag, even if it begins with a "-"; in the BSD version, the flag is "-", and in the S5 version, the flag is "--" (since the S5R3 version, and possibly other versions, use "getopt", which handles "--" for the program using it). So, you can do bsd$ rm - -badfile s5$ rm -- -badfile If your "rm" doesn't have something like that, you can do loser% rm ./-badfile