Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Aug 2003 00:24:35 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Dan Langille <dan@langille.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Is tar doing the right thing here?
Message-ID:  <20030818052435.GE2653@dan.emsphone.com>
In-Reply-To: <3F402191.27576.761E5CF@localhost>
References:  <3F402191.27576.761E5CF@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Aug 18), Dan Langille said:
> Why is this message not being suppressed?
> 
> $ tar -czf test.tgz / 2>&1 > /dev/null
> tar: Removing leading `/' from member names

What you did was dup fd1 onto fd2, then redirect fd1 to /dev/null:

        fd1 -> stdout        fd2 -> stderr
2>&1
        fd1 -> stdout        fd2 -> stdout
>/dev/null
        fd1 -> /dev/null     fd2 -> stdout

Swap the two redirects, so you redirect fd1 to /dev/null, then dup it
onto fd2:

        fd1 -> stdout        fd2 -> stderr
>/dev/null
        fd1 -> /dev/null     fd2 -> stdout
2>&1
        fd1 -> /dev/null     fd2 -> /dev/null

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030818052435.GE2653>