an rm question

00704a-Liber nevin1 at ihlpf.ATT.COM
Sat Apr 16 07:37:24 AEST 1988


In article <27133 at yale-celray.yale.UUCP> moran-william at CS.Yale.EDU (William L. Moran Jr.) writes:
>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.
>Anyway, since the directory they were in was junk I went up one dir
>and did an 'rm -r' on the directory, and that worked. So, being the
>curious sort, I went to the BSD sources and took a look; however, I
>can't figure out why the rm -r worked when the other didn't.

Here is the SVR3 explanation (although it should be the same):

When you use '*', the shell expands it into filenames and then splits them
up via delimiters (such as space) to send to an exec() system call.  On
filenames with bizarre chars in them the split is done incorrectly.

When you use 'rm -r', I think (I haven't looked at the sources lately) that
the file names are taken directly out of the directory file so the shell
expansion problems do not occur.

Hope this helps,
-- 
 _ __			NEVIN J. LIBER	..!ihnp4!ihlpf!nevin1	(312) 510-6194
' )  )				"The secret compartment of my ring I fill
 /  / _ , __o  ____		 with an Underdog super-energy pill."
/  (_</_\/ <__/ / <_	These are solely MY opinions, not AT&T's, blah blah blah



More information about the Comp.unix.wizards mailing list