The Sender Script

The following example is a general-purpose script that reads input and then sends it to another application. You can put this at the end of a pipeline to get a loopback effect to the main application, although you can also use fileevent for similar effects. One advantage of send over fileevent is that the sender and receiver can be more independent. A logging application, for example, can come and go independently of the applications that log error messages:

Example 40-1 The sender application.
 #!/usr/local/bin/wish # sender takes up to four arguments: # 1) the name of the application to send to. # 2) a command prefix. # 3) the name of another application to notify # after the end of the data. # 4) the command to use in the ...

Get Practical Programming in Tcl & Tk, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.