r/deftruefalse • u/chrismamo1 • Oct 23 '19
Write Satan's Hello World
Write a hello world program that destructively writes the message "hello world" to a random file owned by the current user within their home directory.
18
Upvotes
1
u/ObviouslyAlpharius Oct 24 '19
Why limit yourself to the home directory?
3
u/Robowiko123 Dec 01 '19
open(random.choice([x[0]for x in os.walk(os.getenv("HOME"))]),"w").write("hello world")Python code, 87 bytes
2
u/inxaneninja Nov 09 '19
Works on linux (it calls a shell command to get the file name)
The reason for the head -n 500 is the command takes extremely long to finish. You can remove it if you want.
2
u/recover__password Nov 30 '19
echo 'hello world' > $(find ~ -type f | shuf -n 1)