Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Slowcat

Have you ever wanted to slow down the terminal output? Use slowcat, by Dave Capella:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /usr/bin/python
# slowcat.py - print a file slowly
# author : dave w capella - http://grox.net/mailme
# date     : Sun Feb 10 21:57:42 PST 2008
############################################################
import sys, time

delay = .02

if len(sys.argv) > 1:
  arg = sys.argv[1]
  if arg != "-d":
    print "usage: %s [-d delay]" % (sys.argv[0])
    print "delay: delay in seconds"
    print "example: %s -d .02 < vtfile" % (sys.argv[0])
    sys.exit()
  if len(sys.argv) > 2:
    delay = float(sys.argv[2])

while 1:
  try:
    print raw_input()
  except:
    break
  time.sleep(delay)

######################################################################
# eof: slowcat.py

The program is copyright (c) 2002-2008 - dave w capella - All Rights Reserved It is distributed under the terms of the GNU Public License. It includes NO WARRANTY and NO SUPPORT.

References

  1. https://grox.net/software/mine/slowcat/

Comments