No, it does nothing.
$ mkdir test $ cd test ~/test$ touch 1 2 3 4 5 ~/test$ rm -rf ~/test$ ls 1 2 3 4 5
remon@ani.social 1 day ago
It will delete everything in the directory after that, without asking for further confirmation.
No, it does nothing.
$ mkdir test $ cd test ~/test$ touch 1 2 3 4 5 ~/test$ rm -rf ~/test$ ls 1 2 3 4 5
$ mkdir test $ cd test ~/test$ touch 1 2 3 4 5 $ cd .. $ rm -rf test $ ls
No more test folder.
Exactly, but that wasn’t the question.
What are you talking about? The does exactly what I said it does.
It only does nothing for you because you used it incorrectly (in the wrong folder without the required argument),
0xKesh@lemmy.dbzer0.com 1 day ago
Unless it’s on /, where preserve-root should be kicking in, unless the bypass flag is used (can’t remember this one)
Havatra@lemmy.zip 1 day ago
Not all systems have the preserve-root flag enforced, actually… I accidentally did the
rm -rf /in a bash script (the variable for the path returned empty), and it irreversibly deleted a bunch of my system, including sudo and a big part of /etc, before I realized and did Ctrl+C. However the damage was done, rendering the system both unusable and unbootable. Fortunately I managed to recover some data, as the drive was not encrypted.toynbee@piefed.social 21 hours ago
I didn’t personally do this one, but I once worked at a job where I was tasked with updating a kickstart file from RHEL6 to 7. I don’t remember the details, but in the postscript, there was a variable that was set in 6 but not 7. That variable was then used in a command like
rm -rf /${variable}.It took me a little while to figure out why every system imaged with that kickstart was emptying its own filesystem.
0xKesh@lemmy.dbzer0.com 1 day ago
What distro was this out of curiosity? As far as I’m aware preserve-root enforcement comes from upstream coreutils
Havatra@lemmy.zip 1 day ago
Iirc, it was Debian 10 (Buster). I thought they enforced it (
rmdid support it at the time), but perhaps it was tricked by using an empty variable or something?