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 0 2

comments (single view)

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))

View all comments