Created
June 12, 2020 16:03
-
-
Save MurphyPone/40b481b2170b6647e951c1d67a7dd79b to your computer and use it in GitHub Desktop.
A harmless 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
#!/bin/bash | |
white="\033[0;37m" | |
red="\033[0;31m" | |
yellow="\033[0;33m" | |
green="\033[0;32m" | |
blue="\033[0;34m" | |
newTermOpened=0 | |
colors=( $white $red $yellow $green $blue ) | |
numMsg=10 | |
sleepNum=0.04 | |
while [ true ] | |
do | |
msgNum=$((RANDOM % 10)) | |
i=$((RANDOM % ${#colors[@]})) | |
msg=$(cat peter/$((RANDOM % $numMsg))) | |
echo -e "${colors[$i]}$msg" | |
if [ $newTermOpened == 0 ]; then | |
newTermNum=$((RANDOM % 50)) | |
if [ $newTermNum == 0 ]; then | |
tput sgr0 | |
osascript -e 'tell application "Terminal" to do script "./peter/test.sh"' | |
osascript -e 'tell application "Terminal" to do script "./peter/test.sh"' | |
newTermOpened=1 | |
fi | |
fi | |
if [ $newTermOpened == 1 ]; then | |
echo -n -e "\033]0;My Window Name\007" | |
osascript -e 'tell application "Terminal" to close (every window whose name contains "My Window Name")' & | |
fi | |
sleep $sleepNum | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment