Skip to content

Instantly share code, notes, and snippets.

@msimpson msimpson/matrix
Created Jul 21, 2011

Embed
What would you like to do?
Send the Matrix message to someone's terminal (great for scaring ssh users).
#!/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
You can’t perform that action at this time.