Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

64. Pseudoterminals > Implementing script(1)

Implementing script(1)

We are now ready to implement a simple version of the standard script(1) program. This program starts a new shell session, and records all input and output from the session to a file. Most of the shell sessions shown in this book were recorded using script.

In a normal login session, the shell is connected directly to the user’s terminal. When we run script, it places itself between the user’s terminal and the shell, and uses a pseudoterminal pair to create a communication channel between itself and the shell (see Figure 64-4). The shell is connected to the pseudoterminal slave. The script process is connected to the pseudoterminal master. The script process acts as a proxy for the user, taking input entered at the terminal and writing it to the pseudoterminal master, and reading output from the pseudoterminal master and writing it to the user’s terminal.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint