linux shell腳本學(xué)習(xí)錄制與回放終端會話
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 #結(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)行多個用戶之間進(jìn)行廣播視頻會話:打開兩個終端
(1)在終端1中輸入以下命令:
mkfifo scriptfifo
(2)在終端2中輸入以下命令:
cat scriptfifo
(3)返回終端1,輸入以下命令:
script -f scriptfifo
commands...
這樣就實(shí)現(xiàn)了廣播,在線課堂類的作用,非常神奇??!
我自己實(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時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)文章
shell腳本聯(lián)合PHP腳本采集網(wǎng)站的pv和alexa排名
這篇文章主要介紹了shell腳本聯(lián)合PHP腳本采集網(wǎng)站的pv和alexa排名,本文使用PHP腳本采集alexa網(wǎng)站數(shù)據(jù),然后在shell中調(diào)用php腳本并輸出數(shù)據(jù),需要的朋友可以參考下2014-12-12
Shell腳本實(shí)現(xiàn)查找字符串中某字符最后出現(xiàn)的位置
這篇文章主要介紹了Shell腳本實(shí)現(xiàn)查找字符串中某字符最后出現(xiàn)的位置,本文給出了Shell腳本和C語言程序的實(shí)現(xiàn)代碼,需要的朋友可以參考下2015-01-01
解決linux下openoffice word文件轉(zhuǎn)PDF中文亂碼的問題
下面小編就為大家?guī)硪黄鉀Qlinux下openoffice word文件轉(zhuǎn)PDF中文亂碼的問題。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-11-11

