an rm question

Shankar Unni shankar at hpclscu.HP.COM
Sat Apr 16 12:26:31 AEST 1988


> I managed to create a file whose name contained bizarre characters; in
> fact, they were so bizarre that rm * wouldn't remove them (oh well,
> porting arc is a nasty business), I got a nonexistent file message.

This isn't "rm"'s fault: 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. Even quoting doesn't often help (what if the last
character of the file name is '\' ?).

On the other hand, "rm -ir" on the directory containing it helps, because
the shell is no longer involved: "rm" reads the names directly from the
directory.

We had the same problem frequently when people would create files called,
for instance "-b", and rm would choke (-b: illegal option!). The solution
was (a) rm -- -b (the -- terminates the option list, IN MANY IMPLEMENTATIONS),
or (b) rm nonexistentfile -b or (c) /etc/unlink -b (for superusers only).

--scu



More information about the Comp.unix.wizards mailing list