bnick@aucis.UUCP (Bill Nickless) (01/11/89)
In article <4861@mtgzz.att.com>, avr@mtgzz.att.com (a.v.reed) writes: > > In article <9877@drutx.ATT.COM>, csr@drutx.ATT.COM (Steve Roush) writes: > > For strictly interactive use, I use "cu". .... > > I do not know of any UNIX programs outside of AT&T that allow scripting > > of sessions as can be done under DOS. > > Oh yes you do, unless you've never heard of "tee". > And here is how you script a local sh session: > > $ tee -ia script.out | sh -is 2>&1 | tee -ia script.out Only one problem. Unless you are on a tty line, the standard I/O stuff such as printf buffer a solid 512 bytes. (That can be changed by adding a setbuf() line.) Consider the following program: ----cut here---- #include <stdio.h> char s[80]; main() { printf("Enter a string:"); gets(s); printf("You entered:%s\n",s); } ----cut here---- When you execute it in the scripted session, you don't get the prompt "Enter a string:" until AFTER you've entered it! This of course can be fixed if you have the source, but that can't be assumed for every program. -- William (Bill) Kirk Nickless Andrews University 305 Meier Computer and Information Science Department Berrien Springs, MI 49104 UNIX Support Group (616) 471-6515 or (616) 471-3422 ...!uunet!cucstud!aucis!bnick