all 12 comments

sorted by: hot top controversial new old
[–] 31 points 4 months ago (8 children)

Don't you have to pass the --no-preserve-root flag for this to work these days?

  • source
  • hideshow 8 child comments
  • [–] 19 points 4 months ago (6 children)

    Or use /* for the path so it globs to all directories under / whilst not triggering the logic which requires --no-preserve-root.

  • source
  • parent
  • hideshow 6 child comments
  • [–] 33 points 4 months ago (3 children)

    Yes, that's how I nuked my workstation once. Part of my development routine was running sudo rm -rf $SDCARD/*. Guess what happens when SDCARD isn't defined.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 9 points 4 months ago (1 child)

    set -u is your friend. Unless you're running that command interactively, in which case it just exits the shell without giving any warning at all. Oh, the joys of shells written to be compatible with scripts created 20 years ago...

  • source
  • parent
  • hideshow 1 child comment
  • [–] 4 points 4 months ago

    Don't try this at home kids

  • source
  • [–] 3 points 4 months ago

    I did this accidentally on my TrueNAS when I was tired and troubleshooting something after midnight… luckily I had a backup

  • source
  • [–] 2 points 3 months ago

    For those with a full or partial "huh?"

    https://linuxstans.com/sudo-rm-rf/

  • source