[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why doesn't this error message go to the bit bucket?

From: Andreas Schwab
Subject: Re: why doesn't this error message go to the bit bucket?
Date: Mon, 28 Aug 2006 11:46:51 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

"Com MN PG P E B Consultant 3" <address@hidden>

> $ unalias fooee 2>&1 >/dev/null
> bash: unalias: fooee: not found
> Why is the error message displayed here?

Because you have redirected stderr (fd 2) to the channel connected to
stdout (fd 1) before stdout was redirected to a different channel (to

> Because of the redirection, I had expected that any error message
> resulting from the unalias command would go to /dev/null

Read the bash manual, node Redirections:

       Note that the order of redirections is significant.  For example,
    the command
         ls > DIRLIST 2>&1
       directs both standard output (file descriptor 1) and standard error
    (file descriptor 2) to the file DIRLIST, while the command
         ls 2>&1 > DIRLIST
       directs only the standard output to file DIRLIST, because the
    standard error was duplicated as standard output before the standard
    output was redirected to DIRLIST.


Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]