• second@feddit.uk
    link
    fedilink
    English
    arrow-up
    19
    ·
    1 day ago

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

    • hayvan@piefed.world
      link
      fedilink
      English
      arrow-up
      32
      ·
      1 day ago

      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.

      • pivot_root@lemmy.world
        link
        fedilink
        arrow-up
        8
        ·
        1 day ago

        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…

        • hayvan@piefed.world
          link
          fedilink
          English
          arrow-up
          6
          ·
          1 day ago

          It was interactive, but thanks, killing the shell is still better than reinstalling the machine.

    • Sylvartas@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      3
      arrow-down
      1
      ·
      edit-2
      1 day ago

      Shouldn’t it be /*.* for proper nuking or is that unnecessary ? I was told some hidden files would be ignored without it