Deleting a file where the first character in name is a '-'
Rick Stevens
rstevens at vitalstream.com
Thu Sep 9 17:02:07 UTC 2004
csieh wrote:
> On Wed, 8 Sep 2004, Rick Stevens wrote:
>
>
>>csieh wrote:
>>
>>>On Wed, 8 Sep 2004, Waldher, Travis R wrote:
>>>
>>>
>>>
>>>>>-----Original Message-----
>>>>>From: Mark Knecht [mailto:mknecht at controlnet.com]
>>>>>Sent: Wednesday, September 08, 2004 2:33 PM
>>>>>To: Getting started with Red Hat Linux
>>>>>Subject: Deleting a file where the first character in name is a '-'
>>>>>
>>>>>Hi all,
>>>>> Since Rick suggested I'd been absent too long ;-) here's
>>>>>one for the team. How do I delete this file? I'm stumped, but
>>>>>that's easy to do.
>>>>>
>>>>>flash Images $ ls -la
>>>>>total 388776
>>>>>-rw-r--r-- 1 mark users 6920582 Apr 28 15:34
>>>>>-weed-Onion_Jack-Fake_Moon_Landings.wma
>>>>>drwxr-xr-x 2 mark users 4096 Sep 8 14:19 .
>>>>>drwx------ 70 mark users 4096 Sep 8 14:12 ..
>>>>>flash Images $
>>>
>>>
>>>rm ./-weed-Onion_Jack-Fake_Moon_Landings.wma
>>>
>>>You just need to make the file not start with a - and using ./ does that.
>>
>>Actually, the best way is the "--" option. This works on most basic
>>commands (cp, rm, mv, ls, etc.). "--" is a special flag that says "this
>>is the end of the options...the remainder are parameters".
>
>
>
> But not all versions of cp,rm,mv,ls have the -- option.
Most _current_ ones do--especially if they're based on later versions
of getopt(3). The "-?", "--help" or man page may not explicitly state
it, but getopt(3) has supported that since, oh, 1998 or so.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer rstevens at vitalstream.com -
- VitalStream, Inc. http://www.vitalstream.com -
- -
- "OK, so you're a Ph.D. Just don't TOUCH anything!" -
----------------------------------------------------------------------
More information about the Redhat-install-list
mailing list