Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: $Revision: 1.6.2.16 $; site ISM780B.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!bbnccv!ISM780B!geoff From: geoff@ISM780B.UUCP Newsgroups: net.unix-wizards Subject: Re: Redirection quirks: 2>&1 >file -- v Message-ID: <28500057@ISM780B.UUCP> Date: Mon, 6-Jan-86 09:53:00 EST Article-I.D.: ISM780B.28500057 Posted: Mon Jan 6 09:53:00 1986 Date-Received: Wed, 8-Jan-86 20:02:41 EST References: <649@watmath.UUCP> Lines: 19 Nf-ID: #R:watmath:-64900:ISM780B:28500057:000:925 Nf-From: ISM780B!geoff Jan 6 09:53:00 1986 > $ command 2>&1 >file > $ command >file 2>&1 >These are not equivalent using our 4.2bsd Bourne shell. It's a feature. The N > &M says direct descriptor N to wherever discriptor M is currently going. (if N is NULL, "1" is assumed.) The command line is parsed left to right. This feature allows you to (e.g.) swap stdout and stderr so that stderr goes into a pipe for further processing, (and stdout goes wherever else you want it). Otherwise there would be no good way to get anything other than stdout into a pipeline _by itself_. A silly example: $ make 2>&1 >make.out | wc -l | xargs -n1 -i echo You had {} errors. counts only the error and warning message lines from the make output. Not that this is the only way to do that. Geoffrey Kimbrough -- Director of Dangerous Activities -- {decvax!vortex || ihnp4!allegra!ima}!ism780!geoff If I can be of any help, you're in worse trouble than I thought.