Skip to content

Instantly share code, notes, and snippets.

@MurphyPone
Created June 12, 2020 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MurphyPone/40b481b2170b6647e951c1d67a7dd79b to your computer and use it in GitHub Desktop.
Save MurphyPone/40b481b2170b6647e951c1d67a7dd79b to your computer and use it in GitHub Desktop.
A harmless prank
#!/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