I tried to log bash session using:
js:/var/tmp # script -aqf /var/tmp/out
In out
file I see, besides output, a lot of garbage. Instead of just whitespaces and new lines I see this, for example:
Script started on Tue Jul 14 14:17:57 2015
^[[?1034h^[[1m^[[31mjs-om:/var/tmp # ^[(B^[[m^M
^[[1m^[[31mjs:/var/tmp # ^[(B^[[m^M
^[[1m^[[31mjs:/var/tmp # ^[(B^[[m^M
^[[1m^[[31mjs:/var/tmp # ^[(B^[[m^M
^[[1m^[[31mjs:/var/tmp # ^[(B^[[m^M
^[[1m^[[31mjs:/var/tmp # ^[(B^[[mpwd^M
/var/tmp^M
^[[1m^[[31mjs:/var/tmp # ^[(B^[[m^M
^[[1m^[[31mjs:/var/tmp # ^[(B^[[m^M
^[[1m^[[31mjs:/var/tmp # ^[(B^[[m^M
^[[1m^[[31mjs:/var/tmp # ^[(B^[[m^M
^[[1m^[[31mjs:/var/tmp # ^[(B^[[mexit^M
exit^M
I think the problem is with encodings. Is there a solution for this issue?
more -v thescriptfile
. otherwise you'll need, as said below, to avoid your shell (... and commands) to create those escape codes, or find a proper sed to get rid of them (very complex afterwards, as some escape codes look widely different than the ones you show, and thus could take out huge chunks of the real output if you only have regexp trying to get rid of those ones) – Olivier Dulac Jul 15 '15 at 00:50man somecommand
, before I use any command. Especially as similarly named commands have wildly different options on different systems (and sometime completely different actions too, such as "reset" which can either clear the terminal or reboot the host, depending on which system you are loggued into...) – Olivier Dulac Jul 15 '15 at 12:36