From owner-freebsd-stable Fri Oct 11 9:50:24 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5AED037B401 for ; Fri, 11 Oct 2002 09:50:23 -0700 (PDT) Received: from lurza.secnetix.de (lurza.secnetix.de [212.66.1.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id 54FC043E9C for ; Fri, 11 Oct 2002 09:50:22 -0700 (PDT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [IPv6:::1]) by lurza.secnetix.de (8.12.5/8.12.5) with ESMTP id g9BGoImC021532 for ; Fri, 11 Oct 2002 18:50:19 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.12.5/8.12.5/Submit) id g9BGoICR021531; Fri, 11 Oct 2002 18:50:18 +0200 (CEST) Date: Fri, 11 Oct 2002 18:50:18 +0200 (CEST) Message-Id: <200210111650.g9BGoICR021531@lurza.secnetix.de> From: Oliver Fromme To: freebsd-stable@FreeBSD.ORG Reply-To: freebsd-stable@FreeBSD.ORG Subject: Re: New sed breaks ports In-Reply-To: <3DA5C638.10605@potentialtech.com> X-Newsgroups: list.freebsd-stable User-Agent: tin/1.5.4-20000523 ("1959") (UNIX) (FreeBSD/4.6-STABLE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bill Moran wrote: > On a related note, what is the shell magic to redirect > both stdout and stderr to a file, I though it was: > > make REINPLACE_CMD="sed -i" 2>&1 > /dir/file.txt The order of redirects matters. When a redirect occurs on a commandline, if uses the FDs (file descriptors) in effect at that point. "2>&1" connects FD 2 (stderr) to the file associated with FD 1 (stdout). In the above command, that's your terminal, so stderr will be redirected to the terminal. After that, you redirect FD 1 (stdout) to file.txt. Probably not what you want. Try it the other way round: make REINPLACE_CMD="sed -i" >/dir/file.txt 2>&1 Now, first FD1 (stdout) is redirected to file.txt. After that, "2>&1" connects FD 2 (stderr) to the file associated with FD 1 (stdout), which is now file.txt, so both of them will end up in file.txt. This is what you want, I guess. Regards Oliver -- Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "All that we see or seem is just a dream within a dream" (E. A. Poe) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message