How to act on output from a failed command

view story

http://unix.stackexchange.com – I was guessing the ouput of a command that fails to execute should be sent to stdout and hence can be piped. It seems I am wrong, so please correct me. For example, $easy_install The program 'easy_install' is currently not installed. You can install it by typing: sudo apt-get install python-setuptools So if I want to install with the command suggested, I tried $easy_install | grep sudo | bash i.e naively trying to pick out the last line and send it to the shell as a command. I even tried $easy_install | tail -1 | bash but get the same blurb without it doing anything. What am I do (HowTos)