Linux shell Script learning recording and playback terminal session _linux Shell

Source: Internet
Author: User

Copy Code code as follows:

amosli@amosli-pc:~/learn$ script-t 2> timing.log-a output.session# start recording
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
Friday, December 20, 2013 01:06:41 CST
amosli@amosli-pc:~/learn$ exit
Exit #结束录制
Script done, file is Output.session



Play recording:

Copy Code code as follows:

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
Friday, December 20, 2013 01:06:41 CST
amosli@amosli-pc:~/learn$ exit
amosli@amosli-pc:~/learn$

To broadcast video sessions between multiple users: open two terminals

(1) In Terminal 1, enter the following command:

Copy Code code as follows:

Mkfifo Scriptfifo

(2) in Terminal 2, enter the following command:

Copy Code code as follows:

Cat Scriptfifo

(3) Return to Terminal 1 and enter the following command:

Copy Code code as follows:

Script-f Scriptfifo
Commands ...

This is the realization of the broadcast, online classroom class role, very magical!!

The output of my own experiment:

Copy Code code as follows:

Terminal 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:~$

Terminal 2:
amosli@amosli-pc:~$ Cat Scriptfifo
Script started on December 20, 2013 Friday 01:21 19 seconds
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:~$

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.