"Com MN PG P E B Consultant 3" <[EMAIL PROTECTED]>
writes:

> $ 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
/dev/null).

> 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.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
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."


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to