-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Com MN PG P E B Consultant 3 on 8/28/2006 2:41 AM:
> $ unalias fooee 2>&1 >/dev/null
> bash: unalias: fooee: not found
> 
> Why is the error message displayed here? Because of the redirection,
> I had expected that any error message resulting from the unalias
> command would go to /dev/null

Your redirection operators are wrong - you asked bash to copy stderr to
the existing stdout, then silence stdout, but since the copy already took
place, you are not silencing stderr.  So error messages are going to the
original stdout, not /dev/null.  Try this instead:
$ unalias foo >/dev/null 2>&1

Also, if you want to be portable, remember that unalias is a builtin, but
that it is optional.  The only way to portably silence error messages when
your script is designed to run with other shells (such as ash) is to use a
subshell to test whether it will work first:

$ (unalias foo) >/dev/null 2>&1 && unalias foo

- --
Life is short - so eat dessert first!

Eric Blake             [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE8toZ84KuGfSFAYARAnCHAJ9ZuW980IB+xVTpn5/PEfk/EgUOIACcDR2c
zpYhYp0Pf9vmrta/wJynbj8=
=+76q
-----END PGP SIGNATURE-----


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

Reply via email to