Tag Info

Hot answers tagged


The following script should filter out all ANSI/VT100/xterm control sequences for (based on ctlseqs). Minimally tested, please report any under- or over-match. #!/usr/bin/env perl while (<>) { s/ \e[ #%()*+\-.\/]. | (?:\e\[|\x9b) [ -?]* [@-~] | # CSI ... Cmd (?:\e\]|\x9d) .*? (?:\e\\|[\a\x9c]) | # OSC ... (ST|BEL) ...


Updating Gilles' answer to also remove carriage returns and do backspace-erasing of previous characters, which were both important to me for a typescript generated on Cygwin: #!/usr/bin/perl while (<>) { s/ \e[ #%()*+\-.\/]. | \r | # Remove extra carriage returns also (?:\e\[|\x9b) [ -?]* [@-~] | # CSI ... Cmd (?:\e\]|\x9d) ...


You can playback your typescript capture and encode the corresponding screen region using something like: ffmpeg -y -f x11grab -s 100x100 -i :0.0+100,100 -pix_fmt rgb24 -r 5 Desktop/capture.gif -y overwrites the output (most useful when testing) -f x11grab forces the format to x11grab -s 100x100 captured video is 100x100 -i :0.0+100,100 top left corner ...


Untested: record with ttyrec, and convert with tty2gif.


Maybe with: if lsof -tac script "$(tty)" > /dev/null; then echo "I'm running under script" else echo "I'm not" fi You could add something like: lsof -tac script "$(tty)" > /dev/null && PS1="[script] $PS1" To your ~/.zshrc or ~/.bashrc, so the information on whether you're in script or not would be visible on your shell prompt. ...


Interesting problem. I found a small bash script could do the job pretty reliably: #!/bin/bash PP=$(ps -o ppid= $$) while [[ $PP != 1 ]] do LINE=$(ps -o ppid= -o comm= $PP | sed 's/^ *//') COMM=${LINE#* } PP=${LINE%% *} if [[ $COMM == script ]] # Might need a different comparison then echo "In script" exit 0 fi ...


I would use sed in this case. do: cat -v typescript | sed -e "s/\x1b\[.\{1,5\}m//g" sed -e "s/search/replace/g" is standard stuff. the regex is explained as below: \x1b match the Escape preceeding the color code \[ matches the first open bracket .\{1,5\} matches 1 to 5 of any single character. Have to \ the curly braces to keep the shell from mangling ...


# The "sed -r" trick does not work on every Linux, I still dunno why: DECOLORIZE='eval sed "s,${END}\[[0-9;]*[m|K],,g"' => howto use: <commands that type colored output> | ${DECOLORIZE} tested on: - AIX 5.x / 6.1 / 7.1 - Linux Mandrake / Mandriva / SLES / Fedora - SunOS


I couldn't get tty2gif to work right with vim. So I hacked together ttygif.


most easy way to share typescript is http://shelr.tv/ It uses script or ttyrec as backend and you can puslish your typescript as easy as "shelr push last" :)


http://shelr.tv/ is what you need. It allows you to publish typescripts and replay them locally or on the web. It uses script or ttyrec (when script is broken like on Macs or BSD) internally.


cat typescript | perl -pe 's/\e([^\[\]]|\[.*?[a-zA-Z]|\].*?\a)//g' | col -b > typescript-processed

Only top voted, non community-wiki answers of a minimum length are eligible