more details about rm command needed

I know rm(1) was retooled a while back with some safety features, and now flags rm -rf / as an error. I am wondering if it's safety features also flags other attempts to do something similar as errors as well. For example:
cd /; rm -rf *
cd /var; rm -rf ../
etc.

Also, will it catch these types of things in a script?

Thanks.
 
junovitch,

Thanks for the link directly to the code, that's exactly what I was looking for, but I don't know enough about programing to hunt down sections of the 'real' documentation like that.

As an aside, how cumbersome would it be to evolve rm(1) to check if the present working directory is / AND if * is a parameter, or, if ../ would point to /, etc..?

Perhaps this has already been discussed elsewhere and it's over kill, or implementing it would be more complicated then a few lines of code.
 
As an aside, how cumbersome would it be to evolve rm(1) to check if the present working directory is / AND if * is a parameter, or, if ../ would point to /, etc..?
With csh(1) (and tcsh(1)) there's set rmstar:

Code:
dice@molly:~ % cd test/
dice@molly:~/test % ll
total 0
dice@molly:~/test % touch file1
dice@molly:~/test % touch file2
dice@molly:~/test % ll
total 1
-rw-r--r--  1 dice  dice  0 Jan 16 08:40 file1
-rw-r--r--  1 dice  dice  0 Jan 16 08:40 file2
dice@molly:~/test % rm *
dice@molly:~/test % touch file1
dice@molly:~/test % touch file2
dice@molly:~/test % set rmstar
dice@molly:~/test % rm *
Do you really want to delete all files? [n/y] y
 
Back
Top