如何使用脚本创建终端会话的打字稿?
How can I use script to create a typescript of my terminal session?
我应该编译并 运行 我的文件并用脚本将其记录在打字稿中。但是当我尝试它时,我在文件中得到了意想不到的结果。我做错了什么吗?
$ script
Script started, file is typescript
developer@developer-VirtualBox:~/Desktop/kth/os/smallshell/oslab$ gcc -Wall -O4 -ansi -pedantic miniShell.c
developer@developer-VirtualBox:~/Desktop/kth/os/smallshell/oslab$ exit
exit
Script done, file is typescript
developer@developer-VirtualBox:~/Desktop/kth/os/smallshell/oslab$ more typescript
Script started on Mon 18 May 2015 06:38:38 CEST
developer@de
-ansi -pedantic miniShell.cp/kth/os/smallshell/oslab$ gcc -Wall -O4
developer@de
veloper-VirtualBox:~/Desktop/kth/os/smallshell/oslab$ exit
exit
Script done on Mon 18 May 2015 06:38:58 CEST
developer@developer-VirtualBox:~/Desktop/kth/os/smallshell/oslab$
script
记录发送到您终端的 所有 个字符。这包括各种终端控制序列(例如光标移动、颜色等)。
默认情况下,less
(和其他页面)不能很好地使用这些控制字符。使用记录时间信息的 -R
option of less
to allow the program to render the file as it was originally sent. There are some limitations, since even this presumes that the file is not generated in fullscreen mode. To handle that, your best choice is to slowly cat
the file to a terminal with the same size as that on which the file was generated. For that, I use a program slowcat
. Others use a -t
option to script
(但并非所有版本的 script
都可用 - 本质上,Linux-specific)。
或者,您可以使用程序或脚本删除这些控制序列,并获得与 less -R
显示的内容相当的内容(没有视频亮点和颜色)。在 Can I programmatically “burn in” ANSI control codes to a file using unix utils?.
中可以找到有关如何执行此操作的一些讨论
我应该编译并 运行 我的文件并用脚本将其记录在打字稿中。但是当我尝试它时,我在文件中得到了意想不到的结果。我做错了什么吗?
$ script
Script started, file is typescript
developer@developer-VirtualBox:~/Desktop/kth/os/smallshell/oslab$ gcc -Wall -O4 -ansi -pedantic miniShell.c
developer@developer-VirtualBox:~/Desktop/kth/os/smallshell/oslab$ exit
exit
Script done, file is typescript
developer@developer-VirtualBox:~/Desktop/kth/os/smallshell/oslab$ more typescript
Script started on Mon 18 May 2015 06:38:38 CEST
developer@de
-ansi -pedantic miniShell.cp/kth/os/smallshell/oslab$ gcc -Wall -O4
developer@de
veloper-VirtualBox:~/Desktop/kth/os/smallshell/oslab$ exit
exit
Script done on Mon 18 May 2015 06:38:58 CEST
developer@developer-VirtualBox:~/Desktop/kth/os/smallshell/oslab$
script
记录发送到您终端的 所有 个字符。这包括各种终端控制序列(例如光标移动、颜色等)。
默认情况下,less
(和其他页面)不能很好地使用这些控制字符。使用记录时间信息的 -R
option of less
to allow the program to render the file as it was originally sent. There are some limitations, since even this presumes that the file is not generated in fullscreen mode. To handle that, your best choice is to slowly cat
the file to a terminal with the same size as that on which the file was generated. For that, I use a program slowcat
. Others use a -t
option to script
(但并非所有版本的 script
都可用 - 本质上,Linux-specific)。
或者,您可以使用程序或脚本删除这些控制序列,并获得与 less -R
显示的内容相当的内容(没有视频亮点和颜色)。在 Can I programmatically “burn in” ANSI control codes to a file using unix utils?.