Unix problem

Dave Mack csu at alembic.acs.com
Thu Apr 25 14:45:44 AEST 1991


In article <6238 at beryl12.UUCP> mostek at motcid.UUCP (Frank B. Mostek) writes:
>wangjw at cs.purdue.EDU (Jingwen Wang) writes:
>
>>  I was using the X-window and somehow generated some garbage files. I
>>cannot remove some files because these files are named "-C", "-f" etc.
>>Can someone tell me how to remove these garbages? 
>
>Use the find command:
>                                                    
>find . -name "-C" -exec rm -f {} \;

Many versions of rm(1) support the "-" flag, as in

	"rm - -C"

which tells rm that the next argument is not an option even if it
starts with a dash. Check your local man page.

>I am not sure why this works and
>rm -f "-C" does not work.

Because the shell removes the quotes before execing rm. It
works in find because find interprets the argument after
-name as a filename even if it begins with a "-".

-- 
Dave Mack



More information about the Comp.unix.misc mailing list