dotfiles/bin/ansiabuse
michener 83d40113d2 First import
git-svn-id: http://photonzero.com/dotfiles/trunk@1 23f722f6-122a-0410-8cef-c75bd312dd78
2007-03-19 06:17:17 +00:00

16 lines
433 B
Python
Executable file

#!/usr/bin/python
import random
import sys
import commands
colors = ["red", "green", "yellow", "blue", "magenta", "cyan", "white"]
for line in sys.stdin:
echostring = ""
line = line.rstrip();
for x in line:
if x == '\\':
x = '\\\\'
colorname = colors[random.randint(0,6)]
echostring += "$(color lt" + colorname +")" + x
echostring += "$(color off)"
o = commands.getoutput('echo "' + echostring + '"')
print o.rstrip()