Stupid question...

heinz at cc.univie.ac.at heinz at cc.univie.ac.at
Tue May 28 17:13:48 AEST 1991


In <29957 at hydra.gatech.EDU> gt5223b at prism.gatech.EDU (Doug Berkland) writes:

>Along the lines of hard to remove files... is there any way to remove
>a file beginning with a - ?  Using \- doesn't get it... any ideas?
[Signature deleted]

No problem <grin>.

$ echo > -a
$ ls -l
total 54
-rw-r--r--  1 heinz           1 May 28 09:14 -a
-rwxr-xr-x  1 heinz       24576 May 13  1990 b
-rw-r--r--  1 heinz         311 May 13  1990 b.c
-rwxr-xr-x  1 heinz       24576 May 13  1990 c
-rw-r--r--  1 heinz         139 May 13  1990 c.c
drwxr-xr-x  3 heinz        3072 May 27 12:38 junk1
$ rm - -a
$ ls -l
total 53
-rwxr-xr-x  1 heinz       24576 May 13  1990 b
-rw-r--r--  1 heinz         311 May 13  1990 b.c
-rwxr-xr-x  1 heinz       24576 May 13  1990 c
-rw-r--r--  1 heinz         139 May 13  1990 c.c
drwxr-xr-x  3 heinz        3072 May 27 12:38 junk1
$ ^D

Generally, a single '-' on the command line signals the end of the option list.
There may be programs where this trick doesn't work.When in doubt, just try it..

Greetings,
HH
--
--------------------------------------------------------------------------------
---/     Heinz M. Herbeck                    /    Trust me, I know    /       /-
--/     heinz at sophie.pri.univie.ac.at       /    what I'm doing !    /       /--
-/     Vienna University, Austria          /    (Sledge Hammer)     /       /---
--------------------------------------------------------------------------------



More information about the Comp.unix.shell mailing list