This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

CLI Magic: Use ANSI escape sequences to annoy your friends

Posted by: Anonymous [ip: 203.2.120.51] on January 23, 2008 05:35 AM
Ahhh memories..many years ago, learning the tput capabilities, I knocked this together. Yes it is crappy code, but I keep it for sentimental value - not for the popular dance it represents but for the nuisance value it had to a friend and co-worker (it used to trap and ignore control-C and found its way into his .profile if he forgot to lock his screen). It is benign but of course never run what you dont understand and trust. Never ever. Ever.
#! /usr/bin/sh -i
POS=`tput cup 0 0`
clear
while [ 1 ]
do
echo "${POS}"
tput bel
echo " o "
echo "^|\ "
echo " /\ "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "^|^ "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "v|^ "
echo "/< "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "v|v "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "|/v "
echo "/< "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "|X| "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo "<o "
echo " \| "
echo "/< "
echo "${POS}"
tput bel
sleep 1
echo "<o> "
echo " | "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo " o> "
echo " \ "
echo "/< "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo " x "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "</ "
echo "/< "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "<|> "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "</> "
echo "/< "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "<\> "
echo " >\ "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo "<)> "
echo " >> "
echo "${POS}"
tput bel
sleep 1
echo " o "
echo " |\ "
echo " L "
done

#

Return to CLI Magic: Use ANSI escape sequences to display a clock in your terminal