Sometimes cat
just prints too quickly.
Introducing slowcat
!
#!/usr/bin/env python
import sys
import time
try:
timeout_index = sys.argv.index('-t')
timeout = float(sys.argv[timeout_index + 1])
del sys.argv[timeout_index]
del sys.argv[timeout_index]
except:
timeout = 0.1
files = sys.argv[1:]
if not files: files = ['-']
for file in files:
if file == '-':
fin = sys.stdin
else:
fin = open(file, 'r')
for line in fin:
sys.stdout.write(line)
sys.stdout.flush()
time.sleep(timeout)
fin.close()
Combined with my other dotfiles, you can find this on GitHub: slowcat.