Shortest code for infinite disk I/O
PowerShell v2+, 10 bytes
for(){1>1}
Simply loops infinitely with an empty for
loop. Each iteration, we output the integer 1
(implicitly converted to a string) with the >
redirect operator, which overwrites the file named 1
in the local directory.
Pyth, 6 bytes
#.w]]0
Pyth's only file output command is .w
. When called on a string, it writes that string to a file in append mode, which is no good for the purpose of this question. When called on a 2-d array, it writes the corresponding image to that file, overwriting the file contents. That's what this program does. The default file output name is o.png
, so this program infinitely overwrites the file o.png
with a 1-pixel white image. #
is an infinite loop.
If you want a shorter (but more boring than my other one) answer:
Bash, 5 bytes
>w;$0
I could make that shorter if there's a command (less than 3 bytes long) that writes something to disk I/O. Something like sync
would work, but sync
is 4 bytes
Note: this doesn't work when run straight from bash, only when put in a script and run as the script name. (i.e. echo 'w>w;$0' > bomb; chmod 755 bomb; ./bomb
)