Redirection quirks: 2>&1 >file -- vs. -- >file 2>&1

Joseph S. D. Yao jsdy at hadron.UUCP
Mon Jan 6 04:01:50 AEST 1986


In article <3957 at mhuxd.UUCP> rs at mhuxd.UUCP (Robert Sanderman) writes:
>> >     $ command 2>&1 >file
>> >     $ command >file 2>&1
>I understand why the above are different but why do the following
>two lines produce different results:
>	$ 2>&1 command > file
>	$ command 2>&1 > file

Interesting!  Trying permutations, you get:
	2,1 diverted			1 only diverted
	$ command >file 2>&1		$ command 2>&1 >file
	$ 2>&1 command > file		$ 2>&1 > file command
	$ >file 2>&1 command		$ >file command 2>&1
Looks like it takes the '>' tokens from the front and appends them.
Not having source in hand, I'd not venture to say.
-- 

	Joe Yao		hadron!jsdy at seismo.{CSS.GOV,ARPA,UUCP}



More information about the Comp.unix.wizards mailing list