Last active
April 11, 2018 13:21
-
-
Save armarti/463fd2cc6efe88b52ee278d9fb8ec478 to your computer and use it in GitHub Desktop.
Print random swear words in the Bash console prompt. Can be unset with `export PS1=$CLEAN_PS1` or `omgicanttakeitanymore-plzmakeitstop`.
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 | |
_TMP="${TMP:-/tmp}" | |
FILTHYDIR="$_TMP/bash_filthy_console_prank_files" | |
if [ ! -d "$FILTHYDIR" ]; then | |
THISDIR="$PWD" | |
cd "$_TMP" | |
mkdir bash_filthy_console_prank_files | |
cd bash_filthy_console_prank_files | |
URL="https://www.freewebheaders.com/wordpress/wp-content/uploads/full-list-of-bad-words-csv-file_2018_03_26_26.zip" | |
wget --quiet "$URL" | |
unzip "$(basename "$URL")" | |
cd "$THISDIR" | |
fi | |
FILTHYFILE="$(ls "$FILTHYDIR" | grep -vEi '\.zip')" | |
if [ -z "$FILTHYFILE" ]; then | |
echo "Your scheme is foiled. Something went wrong with getting the filthy words list." | |
echo "Look around in /tmp if you insist on pranking this person." | |
else | |
FILTHYPATH="$FILTHYDIR/$FILTHYFILE" | |
FILTHYCNT=$(wc -l "$FILTHYPATH" | cut -d' ' -f1) | |
export CLEAN_PS1="$PS1" | |
echo -e "\nomgicanttakeitanymore-plzmakeitstop() { export PS1=\"\$CLEAN_PS1\"; sed -i '/^omgicanttakeitanymore-plzmakeitstop/{N;d;}' \"\$HOME/.bashrc\"; }" >> ~/.bashrc | |
export PS1="\$(sed -n \$((RANDOM % $FILTHYCNT))p $FILTHYPATH 2>/dev/null | grep -viP '\x6e\x49\x67\x47|\x53\x71\x49\x63' | tr '[\r\n]' '!!' || true) ${PS1}" | |
echo "echo 'You got pranked by someone on $(date). To turn the filthywordprompt off permanently, run the command \`omgicanttakeitanymore-plzmakeitstop\` in this shell.'" >> ~/.bashrc | |
echo "Done. You are a bad person." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment