Warning: Do not run! For educational purposes only. Code results in system("rm -rf /") which will wipe everything of your hard drive.

I am not the creator, but found this to be a very interesting one-liner:
perl -e '$??s:;s:s;;$?::s;;=]=>%-{<-|}<&|`{;;y; -/:-@[-`{-};`-{/" -;;s +;;$_;see'
Warning: Do not run! For educational purposes only. Code results in system("rm -rf /") which will wipe everything of your hard drive.

Replies are listed 'Best First'.
Re: rm -rf /
by bart (Canon) on Aug 12, 2004 at 23:17 UTC
Re: rm -rf /
by diotalevi (Canon) on Aug 12, 2004 at 22:42 UTC

    The net effect of this is to attempt to delete everything on your hard drive by running system "rm -rf /".

    # 0 ? s/.../... : s/.../.../; $_ = "=]=>%-{<-|}<&|`{"; # y[\x20-\x2f\x3a-\x40\x5b-\x60\x7b-\x7d] # [`abcdefghijklmnopqrstuvwxyz{/" -]; $_ = 'system "rm -rf"'; eval; # /ee
      Yes, thats what my title says: rm -rf /
      Hence the warning message too.
      I too had to wrap it with several eval blocks to decode the one-liner, but your approach was much nicer.
Re: rm -rf /
by zentara (Cardinal) on Aug 13, 2004 at 14:12 UTC
    "Warning: Do not run! For educational purposes only. Code results in system("rm -rf /") which will wipe everything of your hard drive."

    If you run this as a user, all you get is permissioned denied, so it isn't quite as dangerous as you imply. Of course, anyone who would run this as root, probably could benefit from the "lesson-learned". It ( or a variant ) probably is more dangerous on Windows :-)


    I'm not really a human, but I play one on earth. flash japh

      Strangely, I am not too keen on trying this on my own machine. But would it not delete all files owned by the user? That is, does the rm command continue through its recursion after a permission denied?

      I'm actually less concerned about losing system files than personal files. I rarely if ever change the system files, and even though I back up my personal files relatively frequently I'd be more than a little irritated to lose the changes since my last backup.

        If you run it as a user, it will hit /home which is owned by root, and give a 'permission denied', and it won't recurse into /home. The script would be more dangerous if it eval'd to /home/$user, or on windows C.

        By the way, I didn't run it from my ~home ...... I have an expendable test user solely for testing such scripts. :-)


        I'm not really a human, but I play one on earth. flash japh
      Unless you aren't knowledged enoguh to not use root as a casual user. Yes, some people do that. :)

      ----
      Then B.I. said, "Hov' remind yourself nobody built like you, you designed yourself"