For those of you who have been following LUG you would have seen my
perl randtype script.

I wrote in shell and python too.

$ cat randtype.sh

lines=`wc -l /etc/passwd | tr -s ' ' | cut -d' ' -f2`
lineno=1
while [ $lineno -ne $lines ];
do
        lineno=`expr $lineno + 1`
        line=`sed -n ${lineno}p /etc/passwd`
        charsinline=`echo $line | wc -c | tr -s ' ' | cut -d' ' -f2`
        charcnt=1
        while [ $charcnt -ne $charsinline ];
        do
                chartoprint=`echo -n $line | cut -c${charcnt}`
                echo -n "$chartoprint"
                sleep 0.12
                charcnt=`expr $charcnt + 1`
        done
        echo
done

$ cat randtype.py

import time
import os
import sys

f=open("/etc/passwd")
lines=f.readlines()

sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
for line in lines:
# First indentation level
        for char in line:
        # indent all following lines with a tab
                 time.sleep(0.02)
                 #print "slept"
                 sys.stdout.write(char)


-Girish

-- 
Gayatri Hitech
web: http://gayatri-hitech.com

SpamCheetah Spam filter:
http://spam-cheetah.com
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to