an rm question

Greg Limes limes at sun.uucp
Tue Apr 19 12:37:59 AEST 1988


In article <670012 at hpclscu.HP.COM>, shankar at hpclscu.HP.COM (Shankar Unni) writes:
>                          Let's say that you managed to create a file called
> "a.*\03\07^q". If you just typed in rm a.*\03\07^q, the *shell* steps in
> and does nasty stuff.

If you put single quotes around it, this name should get through either
/bin/sh or /bin/csh; you will probably need to use your LNEXT character
(as reported by "stty"; usually Ctrl-V) to get the Ctrl-C and Ctrl-G
characters through the line editor.

>                       Even quoting doesn't often help (what if the last
> character of the file name is '\' ?).

Single quotes around the filename take care of this.

> We had the same problem frequently when people would create files called,
> for instance "-b", and rm would choke (-b: illegal option!).

Try using "./" before the filename. For instance, if you have a file
called "-rf *" in your current directory, the command "rm './-rf *'"
would get rid of it. Note the single quotes here, too.

> --scu

-- Greg Limes [limes at sun.com]			frames to /dev/fb



More information about the Comp.unix.wizards mailing list