in reply to Re^3: Capture Keystroke
in thread Capture Keystroke

That sounds like something I could use. Is that a module, shmem?

Replies are listed 'Best First'.
Re^5: Capture Keystroke
by shmem (Chancellor) on Apr 13, 2009 at 20:02 UTC

    No, it is a UNIX command, which appeared in BSD 3.0. It spawns your $SHELL and makes a typescript of everything printed to the terminal, including backspaces, terminal control sequences and such. See 'man script'. The script(1) command's STDERR can be directed to a file to record the timing of all that appears on the terminal. Of course, anything typed while the terminal is in '-echo' mode won't appear (e.g. passwords). The script file and the timing file can be used to replay the captured outout. Joey Hess wrote a public domain perl script called scriptreplay which does that.

Re^5: Capture Keystroke
by repellent (Priest) on Apr 14, 2009 at 17:57 UTC
    On Unix:
    > script Script started, file is typescript > ls -ld /typo^H^H^H^Hetc drwxr-xr-x 117 root root 12288 2009-04-13 16:22 /etc > exit Script done, file is typescript

    and then perl -pe 's/\e([^\[\]]|\[.*?[a-zA-Z]|\].*?\a)//g' typescript

    filters the escape codes, and prints this out as-is:

    Script started on Tue 14 Apr 2009 10:48:10 AM PDT > ls -ld /etc drwxr-xr-x 117 root root 12288 2009-04-13 16:22 /etc > exit Script done on Tue 14 Apr 2009 10:48:22 AM PDT