複製代碼 代碼如下:
amosli@amosli-pc:~/learn$ script -t 2> timing.log -a output.session#開始錄製
Script started, file is output.session
amosli@amosli-pc:~/learn$ hello1
No command 'hello1' found, did you mean:
Command 'hello' from package 'hello-debhelper' (main)
Command 'hello' from package 'hello' (main)
hello1: command not found
amosli@amosli-pc:~/learn$ who
amosli tty7 2013-12-19 22:58
amosli pts/1 2013-12-19 22:59 (:0.0)
amosli pts/2 2013-12-19 23:16 (:0.0)
amosli@amosli-pc:~/learn$ time
real 0m0.000s
user 0m0.000s
sys 0m0.000s
amosli@amosli-pc:~/learn$ date
2013年 12月 20日 星期五 01:06:41 CST
amosli@amosli-pc:~/learn$ exit
exit #結束錄製
Script done, file is output.session
播放錄製:
複製代碼 代碼如下:
amosli@amosli-pc:~/learn$ scriptreplay timing.log output.session #按播放命令序列輸出
amosli@amosli-pc:~/learn$ hello1
No command 'hello1' found, did you mean:
Command 'hello' from package 'hello-debhelper' (main)
Command 'hello' from package 'hello' (main)
hello1: command not found
amosli@amosli-pc:~/learn$ who
amosli tty7 2013-12-19 22:58
amosli pts/1 2013-12-19 22:59 (:0.0)
amosli pts/2 2013-12-19 23:16 (:0.0)
amosli@amosli-pc:~/learn$ time
real 0m0.000s
user 0m0.000s
sys 0m0.000s
amosli@amosli-pc:~/learn$ date
2013年 12月 20日 星期五 01:06:41 CST
amosli@amosli-pc:~/learn$ exit
amosli@amosli-pc:~/learn$
進行多個使用者之間進行廣播視頻會話:開啟兩個終端
(1)在終端1中輸入以下命令:
複製代碼 代碼如下:
mkfifo scriptfifo
(2)在終端2中輸入以下命令:
複製代碼 代碼如下:
cat scriptfifo
(3)返回終端1,輸入以下命令:
複製代碼 代碼如下:
script -f scriptfifo
commands...
這樣就實現了廣播,線上課堂類的作用,非常神奇!!
我自己實驗的輸出:
複製代碼 代碼如下:
終端1:
amosli@amosli-pc:~$ mkfifo scriptfifo
amosli@amosli-pc:~$ script -f scriptfifo
Script started, file is scriptfifo
amosli@amosli-pc:~$ who
amosli tty7 2013-12-19 22:58
amosli pts/1 2013-12-19 22:59 (:0.0)
amosli pts/2 2013-12-20 01:14 (:0.0)
amosli pts/4 2013-12-20 01:16 (:0.0)
amosli pts/5 2013-12-20 01:20 (:0.0)
amosli pts/6 2013-12-20 01:20 (:0.0)
amosli@amosli-pc:~$
終端2:
amosli@amosli-pc:~$ cat scriptfifo
Script started on 2013年12月20日 星期五 01時21分19秒
amosli@amosli-pc:~$ who
amosli tty7 2013-12-19 22:58
amosli pts/1 2013-12-19 22:59 (:0.0)
amosli pts/2 2013-12-20 01:14 (:0.0)
amosli pts/4 2013-12-20 01:16 (:0.0)
amosli pts/5 2013-12-20 01:20 (:0.0)
amosli pts/6 2013-12-20 01:20 (:0.0)
amosli@amosli-pc:~$