Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site turtlevax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!turtlevax!ken From: ken@turtlevax.UUCP (Ken Turkowski) Newsgroups: net.unix-wizards Subject: Re: Redirection quirks: 2>&1 >file -- vs. -- >file 2>&1 Message-ID: <1013@turtlevax.UUCP> Date: Fri, 3-Jan-86 13:22:28 EST Article-I.D.: turtleva.1013 Posted: Fri Jan 3 13:22:28 1986 Date-Received: Sun, 5-Jan-86 01:11:32 EST References: <649@watmath.UUCP> Reply-To: ken@turtlevax.UUCP (Ken Turkowski) Organization: CIMLINC, Inc. @ Menlo Park, CA Lines: 16 In article <649@watmath.UUCP> idallen@watmath.UUCP writes: > $ command 2>&1 >file > $ command >file 2>&1 >These are not equivalent using our 4.2bsd Bourne shell. (The 2>&1 in the >first line redirects unit 2 to the tty, not to the file.) >Is this a feature or a bug? Comments not worthy of world-wide >net readership should be mailed to me, not posted, please. Yes, this is how it works. Redirections are parsed and executed in order, so that in the first case, fd2 is dup'ed from fd1, and then fd1 is redirected, and in the second case fd1 is redirected, followed by fd2 being dup'ed from the new fd1. -- Ken Turkowski @ CIMLINC, Menlo Park, CA UUCP: {amd,decwrl,hplabs,seismo,spar}!turtlevax!ken ARPA: turtlevax!ken@DECWRL.DEC.COM