在ubuntu/或者其他linux下運行,script screen.log,記錄屏幕信息到screen.log裏,一直記錄到你exit爲止,記錄屏幕log的好方法…
root@ubuntu2:/# script screen.log
Script started, file is screen.log
root@ubuntu2:/# ls -ltr
total 76
省略若干行>>>>>>>>>>>>>>>
root@ubuntu2:/# exit
exit
Script done, file is screen.log
root@ubuntu2:/# cat screen.log
Script started on Wed Sep 24 21:34:52 2008
root@ubuntu2:/# ls -ltr
total 76
省略若干行>>>>>>>>>>>>>>>
root@ubuntu2:/# exit
exit
Script done on Wed Sep 24 21:35:04 2008
已經找到了解決方法,異常退出也沒有問題,仍然記錄log,需要加上參數,script -f ido.log,如果在一個終端上使用mkfifo ido.log;script -f ido.log 然後在另一個終端登錄,找到這個ido.log文件,你tail -f 就會滾動輸出你操作的內容..這個非常方便…
2.使用script的缺點在於,它記錄所有特殊的字符;因此你輸入的文件中將充滿控制字符和ANSI轉義序列。你可以在script中使用一個非常簡單的shell來解決這個問題:
SHELL=/bin/bash PS1=”$ ” script
使用script時,不要使用交互式程序或處理窗口的程序,如vior top。它們會破壞會話的輸出結果。另外,日誌文件會記錄你使用的任何命令行程序和你完成一項任務所採取的步驟。如果你需要在腳本中編輯一個文件,考慮退出script會話,然後用script –a(它在舊會話後添加新會話)對文件進行編輯後再重新啓動會話。