Mailinglist Archive: opensuse (924 mails)

< Previous Next >
[opensuse] Re: add prompt to rm command (just change POSIX!)
David Haller wrote:
If you don't want to use 'rm' in the way it was intended to (see
above), then just do not use it.
No No No...

You just go change POSIX... ... That's what some people did.

You used to be able to delete all files in a directory (AND NOT the directory)
VERY safely by using
cd "dir" && rm -fr .

You also used to be able to shut off all messages (ignoring errors with
permissions, etc), using "-f".

But both of those have been changed .

In fact, there is no way to get rm to remove all files
in a directory and not also remove the directory without using
some 'helper' (like shell or find). I.e. "rm *" relies
on the shell to expand things, BUT posix changed things there
recently as well.

"echo *" used to not show hidden files. Now it does, by default
(unless you toggle an option in bash to undo it).

If you want to safely delete all files under a dir on the same
file system? I.e. like "rm -fr --onefilesystem .", don't think
that "rm -fr --onefilesystem *" will due the same thing. It won't.

Of course you can still use "cp -a foo ." and end up with dir 'foo' in
dot, vs. "cp -a foo/. ." to get all contents of foo in ".", but you
cannot use rm -fr foo/.

Of course "rm -r foo" may delete "foo" but not it's contents, if
foo was a symlink (just like ls foo => gives foo@") or even
"ls foo/" => "foo/@" if the '/' was given when creating the symlink.

But you _could_ get the contents using "foo/." -- but not as of
about 2 years ago when POSIX 2008's changes came into force in 2010
release of SUSE10.2 or .1 (wasn't in 10).

So if you don't like the way things work and think it is not safe
enough -- you can just get the command changed and make unix more
like Windows...


To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups