Skip to content

Instantly share code, notes, and snippets.

@rlyon
Last active January 3, 2016 23:29
Show Gist options
  • Save rlyon/8535717 to your computer and use it in GitHub Desktop.
Save rlyon/8535717 to your computer and use it in GitHub Desktop.
Fake directory cleaning script. Scare users, have a few laughs. Just add 'source /path/to/bofh_cleaning.sh' to the users bashrc file.
#!/bin/bash
trap "touch $HOME/.bofh_interupted" SIGINT
echo "####################################################"
echo "# This is the home directory cleaning process. #"
echo "####################################################"
echo
###
### Get their blood pumping...
###
echo "All files will be removed in 5 seconds."
echo "---"
counter=5
while [ $((counter)) -gt 0 ] ; do
echo $counter
sleep 1
counter=$((counter - 1))
done
echo "---"
###
### Now scare them!!!
###
if ! [[ -f "$HOME/.bofh_done" ]] ; then
for file in $(find .) ; do
echo "REMOVING: $file"
done
echo
if [[ -f "$HOME/.bofh_interupted" ]] ; then
echo "Opps, my bad. You tried to stop the cleaning."
echo "This is awkward, your files are all gone."
rm $HOME/.bofh_interupted
else
echo "Thank you for helping us free up addition space."
fi
touch $HOME/.bofh_done
echo
else
echo "Directory is empty. Nothing to do"
fi
###
### A little slight of hand here :)
###
mkdir -p /tmp/bofh/$USER
PS1="[\u@\h: ~]\\$ "
cd /tmp/bofh/$USER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment