Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: Redirecting stderr in csh Message-ID: <9586@mimsy.UUCP> Date: Tue, 1-Dec-87 19:25:03 EST Article-I.D.: mimsy.9586 Posted: Tue Dec 1 19:25:03 1987 Date-Received: Sat, 5-Dec-87 00:17:53 EST References: <1254@saturn.ucsc.edu> <1650003@acf8.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 34 In an article whose referent has been deleted by deficient software, I included the following sh code, stating that the same thing cannot be done in csh: >> >Perrors; >ierrors; >perrors; >eerrors >> while loop; do >> P 2>>Perrors | i 2>>ierrors | p 2>>perrors | e 2>>eerrors >> done | filter In article <1650003@acf8.UUCP> berke@acf8.UUCP (Wayne Berke) writes: >Never say never. What about: > >#!/bin/csh >touch Perrors; touch ierrors; touch perrors; touch eerrors (First mistake! :-) `touch' and `>' are different; use `: > Perrors' to clobber file Perrors, or use `cp /dev/null Perrors' [longer and slower]. Your loop should then have `>>&'s, not `>&'s, below.) >while (1) > (P | (i | (p | (e > /dev/tty) >& eerrors) >& perrors) >& ierrors) >& Perrors >end >Yes, I know its ugly. Also doesn't address how to pipe fit the output >of a while loop, but that's a different issue. That was why I included the `| filter' in my example. Also, the `e > /dev/tty' is still wrong even without the `| filter' in the sh example. Consider: Assuming the C shell script is in the file `example.csh', running `example.csh' works as expected, but running `example.csh > ex.out' works rather differently---or more accurately, works in precisely the same way! `ex.out' winds up empty, instead of having the output from `e'. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris