88
\$\begingroup\$

Challenge:

In the programming language of your choice, shut down the machine that your code was executed on.

Rules

  • No shutting down by resource exhaustion (e.g.: forkbomb to force shutdown)
  • You are allowed to write code that only works in a specific environment/OS, if you wish.
  • Standard loopholes are forbidden

This is , thus the lowest amount of bytes wins!

\$\endgroup\$
33
  • 67
    \$\begingroup\$ I got friends, who do this in school and think they are 'hacking' :D \$\endgroup\$
    – Penguin9
    Commented Jan 24, 2017 at 14:00
  • 13
    \$\begingroup\$ We should come up with some rule once to stop such `whatever`; Bash/Perl/PHP/Ruby/etc. stupiglots. \$\endgroup\$
    – manatwork
    Commented Jan 24, 2017 at 14:22
  • 276
    \$\begingroup\$ Windows, 0 bytes. Leave the computer on for a few days and let automatic updates do their work \$\endgroup\$
    – Luis Mendo
    Commented Jan 24, 2017 at 15:17
  • 29
    \$\begingroup\$ Anybody else notice the lack of TIO-links? \$\endgroup\$
    – steenbergh
    Commented Jan 24, 2017 at 16:37
  • 9
    \$\begingroup\$ @MontyHarder After reading that page I have decided to coin the term shatdown: past tense of the verb shutdown \$\endgroup\$
    – FGreg
    Commented Jan 24, 2017 at 17:34

61 Answers 61

1 2
3
0
\$\begingroup\$

05AB1E (legacy) prior to commit June 4th, 2018, 10 bytes

’À…„‹/p’.E

Try it online without the .E.

Explanation:

In the commit of June 4th, 2018, the builtin .E has been changed from run_as_Bash_code to run_as_Python_code. So this only works prior to this commit.

’À…„‹/p’    # Push dictionary string "shutdown/p"
        .E  # Run it as Bash code

05AB1E, 25 bytes

’£Ø os;os.‚«('À…„‹/p')’.E

Try it online without the .E.

Explanation:

The .E builtin is eval_in_Python in the current version of 05AB1E.

’£Ø os;os.‚«('À…„‹/p')’    # Push dictionary string "import os;os.system('shutdown/p')"
                       .E  # Evaluate as Python code

See this 05AB1E tips of mine (section How to use the dictionary?) to understand why ’À…„‹/p’ is "shutdown/p" and ’£Ø os;os.‚«('À…„‹/p')’ is "import os;os.system('shutdown/p')".

Note: Both work only on Windows. Could be modified to also work on other OS, i.e. "init 0".E and ’£Ø os;os.‚«('„‡ƒŸ')’.E for Linux.

\$\endgroup\$
1 2
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.