• Gyroplast@pawb.social
    link
    fedilink
    English
    arrow-up
    44
    ·
    1 month ago

    Shell footgun. The || only looks at the return value of the preceding command, rm -fr /. There’s an edge case of the command returning a non-zero error code triggering the statement intended to run if, and only if, the condition is false.

    [ 0 -eq 0 ] && { echo "I am in your PCs, deleting your p0rn"; false; } || echo "Lucky you?"
    

    Use if clauses, people. These test abuses do not make one look extra-smart.

    On an unrelated note, I lost on the first try.

  • ViatorOmnium@piefed.social
    link
    fedilink
    English
    arrow-up
    20
    ·
    1 month ago

    rm -rf / won’t actually do anything in most Linux systems. GNU coreutils’ rm will only remove the root with --no-preserve-root.

  • mote@lemmy.ca
    link
    fedilink
    arrow-up
    10
    ·
    1 month ago

    Al, we need to optimize. Speed and efficiency to prevent Ctrl+C.

    Write 16MB of zeros to the beginning of the boot device to overwrite the boot blocks (16MB being extra cautious, 8MB is fine) and if you want to double the roulette fun, have it fork in parallel and do the same thing to the EFI partition (if you have one). Extra credit: fork a 3rd time and write 16MB to the end of the disk, nuking the backup GPT structure sitting there. This can all be a fun inline “one-liner” to appeal to cut & pasters. curl pipe bashers.

    It’ll happen so fast there’s no stopping it, their only way out now is to get the running system saved off that disk while it’s mounted.[1] But your nuke is invisible, how long until they find out trying to reboot? Devious Al, you’re just devious.

    [1] there is a way to recover if you build identical machines, like VMs or VPSes - a tool such as gdisk can pull the table(s) off one to a file, which can be pushed onto another. We’ve recovered $customer mistakes at $ITjob doing this before, it works. It might not boot properly, but it can contain enough filesystem boundary information to be able to recover a partition manually (rescue).

  • auzy1@lemmy.world
    link
    fedilink
    arrow-up
    9
    ·
    1 month ago

    If you’re like me and press up to run a previous command from history, you’re definitely toasting your system eventually accidentally

    • luciferofastora@feddit.org
      link
      fedilink
      arrow-up
      1
      ·
      1 month ago

      What could be more fun than hiding a landmine in your “convenience pile”? Every time you don’t want to retype a command, you’re gambling. Is it worth the risk to save those two keystrokes on ll?

  • Digit@lemmy.today
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 month ago

    LMAO! OMIGOSH!

    I cannot, in good conscience, vote this up, nor down. LOL.

    Nothing has got me laughing as hard or as fast, for years.

    I still can’t upvote this. LOL. NOOOOOO! LOL. XD

      • Digit@lemmy.today
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 month ago

        Facebook user’s would get what that is in the OP?

        Huh.

        It must have changed from when I would still hang around facebook users.