How does the piped program know that it is piped? I would think that all it knows is that it is outputing to sdtout. Who changes the data in the pipe? The shell? Alan At 01:33 PM 7/26/01 -0700, you wrote: >On Jul 26, 1:03pm, Gorman, John wrote: > >> Here is an example: telnet hostname | tee hostname.log >> >> What this does is telnet to host hostname and record the commands >> and output from that into the currenct directory as the filename >> hostname.log. >> >> By the way, this is an excellent way to record your testing history, >> or save your actions for someone who wants to follow what you did at >> a later time. > >The problem with using tee for this purpose is that stdout is no >longer connected to a tty (or even a pseudo-tty). This means that >some programs will behave quite differently than they would have had >you not thrown the pipe in. > >A better way to capture this kind of output is to use ``script''... > > ocotillo:kev$ script > Script started, file is typescript > ocotillo:kev$ echo foo > foo > ocotillo:kev$ exit > exit > Script done, file is typescript > ocotillo:kev$ cat typescript > Script started on Thu Jul 26 13:27:14 2001 > ocotillo:kev$ echo foo > foo > ocotillo:kev$ exit > exit > > Script done on Thu Jul 26 13:27:24 2001 > >An example of a program that behaves differently when it's connected >to a terminal vs a pipe is ``ls''. Try doing just ``ls'' and then >``ls | cat'' (or even ``ls | tee''). You'll find that that the former >gives you a listing with multiple columns while the latter gives you >a listing with a single column. > >Kevin >________________________________________________ >See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post to the list quickly and you use Netscape to write mail. > >PLUG-discuss mailing list - PLUG-discuss@lists.PLUG.phoenix.az.us >http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss > > >