Created
July 21, 2011 11:00
-
-
Save msimpson/1096964 to your computer and use it in GitHub Desktop.
Send the Matrix message to someone's terminal (great for scaring ssh users).
This file contains hidden or 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 | |
[ ! "$1" ] && { | |
echo "Usage: matrix <pts-number>" | |
echo "Grabs control of a terminal and sends the Matrix message." | |
echo | |
echo "Choose a pts number:" | |
echo -e "Number\tUser\tName" | |
ps aux | awk '/pts\// && /bash/ {print $7":\t("$1")\t"$11}' | |
exit | |
} | |
{ | |
tput smcup | |
tput civis | |
clear | |
echo "Wake up, ${USER^}..." | |
sleep 4 | |
clear | |
s="The Matrix has you..." | |
for ((i=0;i<${#s};i++)); do | |
echo -n "${s:$i:1}" | |
case $i in | |
[0-2]) sleep 0.5;; | |
[3-6]) sleep 0.2;; | |
[7-8]) sleep 0.5;; | |
[9-11]) sleep 0.2;; | |
[12-13]) sleep 0.5;; | |
*) sleep 0.2;; | |
esac | |
done | |
sleep 3 | |
clear | |
s="Follow the white rabbit." | |
for ((i=0;i<${#s};i++)); do | |
echo -n "${s:$i:1}" | |
sleep 0.05 | |
done | |
sleep 3.5 | |
clear | |
echo "Knock. Knock. ${USER^}." | |
sleep 2.5 | |
tput rmcup | |
} > /dev/pts/$1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment