From owner-freebsd-questions Fri Nov 28 13:54:27 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id NAA11339 for questions-outgoing; Fri, 28 Nov 1997 13:54:27 -0800 (PST) (envelope-from owner-freebsd-questions) Received: from mail.virginia.edu (mail.Virginia.EDU [128.143.2.9]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id NAA11334 for ; Fri, 28 Nov 1997 13:54:20 -0800 (PST) (envelope-from atf3r@cs.virginia.edu) Received: from mail.cs.virginia.edu by mail.virginia.edu id aa18932; 28 Nov 97 16:54 EST Received: from mamba.cs.Virginia.EDU (mamba-fo.cs.Virginia.EDU [128.143.136.18]) by ares.cs.Virginia.EDU (8.8.5/8.8.5) with ESMTP id QAA14687; Fri, 28 Nov 1997 16:54:17 -0500 (EST) Received: from localhost (atf3r@localhost) by mamba.cs.Virginia.EDU (8.7.5/8.7.3) with SMTP id QAA05017; Fri, 28 Nov 1997 16:54:16 -0500 (EST) X-Authentication-Warning: mamba.cs.Virginia.EDU: atf3r owned process doing -bs Date: Fri, 28 Nov 1997 16:54:16 -0500 (EST) From: "Adrian T. Filipi-Martin" Reply-To: Adrian Filipi-Martin To: Jacques Hugo cc: questions@freebsd.org Subject: Re: 2>&1 ??? In-Reply-To: <347E7CEE.41C67EA6@wired.ctech.ac.za> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Fri, 28 Nov 1997, Jacques Hugo wrote: > Hi there ... > > What exacltly does this means under sh/bash: > do something 2>&1 wherever. > > What does the 2>&1 do and where can you use > other vatiations with it? >& is a redirection operator of the shell, just like >, <, |, etc. ${fd1}>&${fd2} duplicates the output file descriptor on the right, ${fd2}, onto the file descriptor on the left, ${fd1}. Thus, 2>&1, duplictes the stdout file descriptor onto the stderr one. The net result is that anything your redirected pogram writes to stderr/2 will actually appear on stdout/1. This is useful if you have error output and you want to use a pager like more or less. e.g. "patch -p < patchfile 2>&1 | more". You can find more in the bash manpage under "REDIRECTION" section. You might also take a look at the dup2(2) man page. > Thanks > -Jacques > > ------------------------------------------------------ > The box said "Requires Windows 3.1 or better" > ... so I got BSD ^^^^^ hehe. cute! Adrian -- adrian@virginia.edu ---->>>>| If I were stranded on a desert island, and System Administrator --->>>| I could only have one OS for my computer, Neurosurgical Visualzation Lab -->>| it would be FreeBSD. Think about it..... http://www.nvl.virginia.edu/ ->| http://www.freebsd.org/