linux shell腳本學(xué)習(xí)錄制與回放終端會(huì)話
amosli@amosli-pc:~/learn$ script -t 2> timing.log -a output.session#開(kāi)始錄制
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 #結(jié)束錄制
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$
進(jìn)行多個(gè)用戶(hù)之間進(jìn)行廣播視頻會(huì)話:打開(kāi)兩個(gè)終端
(1)在終端1中輸入以下命令:
mkfifo scriptfifo
(2)在終端2中輸入以下命令:
cat scriptfifo
(3)返回終端1,輸入以下命令:
script -f scriptfifo
commands...
這樣就實(shí)現(xiàn)了廣播,在線課堂類(lèi)的作用,非常神奇?。?/P>
我自己實(shí)驗(yàn)的輸出:
終端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時(shí)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:~$
相關(guān)文章
linux重啟和關(guān)閉系統(tǒng)命令的寫(xiě)法
這篇文章給大家介紹了linux重啟和關(guān)閉系統(tǒng)命令的寫(xiě)法,然后在文中給大家分享了linux五個(gè)重啟命令,感興趣的朋友一起看看吧2017-10-10淺談ctrl+c,ctrl+d,ctrl+z在linux中的意義
下面小編就為大家?guī)?lái)一篇淺談ctrl+c,ctrl+d,ctrl+z在linux中的意義。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-01-01