Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!nysernic!itsgw!leah!uwmcsd1!ig!jade!ucbvax!ucsfcgl!pixar!unicom!dv From: dv@unicom.UUCP Newsgroups: comp.unix.questions Subject: Re: Redirecting stderr in csh Message-ID: <211@unicom.UUCP> Date: Fri, 4-Dec-87 02:51:32 EST Article-I.D.: unicom.211 Posted: Fri Dec 4 02:51:32 1987 Date-Received: Tue, 8-Dec-87 03:04:52 EST References: <1254@saturn.ucsc.edu> <1650003@acf8.UUCP> <9586@mimsy.UUCP> Reply-To: dv@unicom.UUCP (David W. Vezie) Organization: UNIx at College Of Marin, Kentfield CA Lines: 34 I didn't write the article Chris replied to, but I said the same thing, so I'll reply to this: In article <9586@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >>while (1) >> (P | (i | (p | (e > /dev/tty) >& eerrors) >& perrors) >& ierrors) >& Perrors >>end > >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'. That's true. There's no way to have the well-buried 'e' know where the origional stdout was. I suppose you could do something with named pipes (if you had them), but at that point, it would be easier to re-write the script in Bourne Shell. I don't really see any reason why to write shell scripts in csh (unless you have a pressing need to have multiple-element variables). But the (cmd > file) >& otherfile is handy. For example, I have an alias like: alias MK '(make \!* >! MKCOMS) >&! MKERRS &' So that the commands go in one file, and the diags go in another file. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= David W. Vezie, Systems Hacker | "I support Star Wars (tm), {{sun,ucbvax}!pixar,well}!unicom!dv | it's SDI I can't stand" --ME