Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-unix!quintus!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!stc!datlog!dlhpedg!cl From: cl@datlog.co.uk (Charles Lambert) Newsgroups: comp.unix.questions Subject: Detecting pipe closure in shell script Message-ID: <380@dlhpedg.co.uk> Date: 14 Jan 88 16:47:24 GMT Sender: news@dlhpedg.co.uk Reply-To: cl@datlog.co.uk (Charles Lambert) Organization: FSG@Data Logic Ltd, Queens House, Greenhill Way, Harrow, London. Lines: 21 I have a shell script with the following fragment in it: | tee $TFILE | more If I quit more(1) before output from tee(1) is complete, I want to scrap $TFILE, else I want to move it to another name. I've tried | ( trap 'rm $TFILE' 13; tee ) | more; mv $TFILE othername and | ( tee ; mv $TFILE othername) | more but in both cases the move occurs regardless of completion (in the second case, the "mv" seems to be executing even after shell script has exited). Any smart tricks? ---------------------- Charles Lambert