Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84; site bdaemon.UUCP Path: utzoo!linus!decvax!ucbvax!ucdavis!lll-crg!seismo!hao!nbires!bdaemon!carl From: carl@bdaemon.UUCP (carl) Newsgroups: net.unix-wizards Subject: Re: Redirection quirks: 2>&1 >file -- vs. -- >file 2>&1 Message-ID: <350@bdaemon.UUCP> Date: Sun, 5-Jan-86 23:50:24 EST Article-I.D.: bdaemon.350 Posted: Sun Jan 5 23:50:24 1986 Date-Received: Tue, 7-Jan-86 06:32:57 EST References: <649@watmath.UUCP> <424@well.UUCP> Organization: Daemon Assoc., Boulder, CO Lines: 22 > In article <649@watmath.UUCP> idallen@watmath.UUCP writes: > >Consider: > > > > $ 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.) > The real explanation for all of this is that once a Bourne shell command line has been read (up to \n or ; or & etc.) it is evaluated from right to left. To convince yourself, try foobar=${foo}${bar} foo="hello" bar=" world" versus foo="hello" bar=" world" foobar=${foo}${bar} Carl Brandauer {allegra|amd|attunix|cbosgd|ucbvax|ut-sally}!nbires!bdaemon!carl