Skip to content

Instantly share code, notes, and snippets.

@coderbyheart
Last active March 4, 2016 13:19
Show Gist options
  • Save coderbyheart/29bc3ec786ee5c93b48b to your computer and use it in GitHub Desktop.
Save coderbyheart/29bc3ec786ee5c93b48b to your computer and use it in GitHub Desktop.
pin.sh
#!/bin/bash
# Use pin.sh to prevent accidently repeating of dangerous commands
# Usage:
# $ pin.sh rm -rf /
# $ Please type the PIN 7945 to continue: 1234
# $ Sorry :-(
PIN="$(((RANDOM % 9)+1))$(((RANDOM % 9)+1))$(((RANDOM % 9)+1))$(((RANDOM % 9)+1))"
echo -n "Please type the PIN $PIN to continue: "
read TYPEDPIN
if [ "$TYPEDPIN" = "$PIN" ];
then
$*
else
echo "Sorry :-(";
fi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment