juniperr @juniperr

russian roulette as a bash script:

random=$(($(od -vAn -N4 -t u4 < /dev/urandom) % 6))

if [[ $random -eq 5 ]]; then
    echo "Killing system"
    sudo rm -rf / --no-preserve-root
else
    echo "Safe"
fi
3 days ago
2
View all Parent

comments

Highlighted comment

honestly im not great at bash LMAO

theres apparently a built in $RANDOM var in bash that does the job more concisely than random=$(($(od -vAn -N4 -t u4 < /dev/urandom) % 6))