You can use the
script command to record an xterm session. That said, an ncurses program will fill the typescript file with unreadable escape chars. But if you tell script to save both a
typescript file and a
timing file, then your xterm session can be replayed perfectly with
scriptreplay. True, even if you have been using ncurses etc.
Not an exact fit to your original question, but close enough for me to mention.
Code:
$ script -f -t transcript.log 2>timing.log
# Do some work here, ncurses etc if you like...
$ exit
# To replay the session...
$ scriptreplay timing.log transcript.log
Happy with ur solution... then tick "yes" and mark as Solved!