There may be some oddities to my configuration here, just a note. I'm on Mac OS X Mountain Lion but am using coreutils installed via Homebrew:
I have a few functions in my .bash_profile I use for grepping through Python programs.
function greppy() { find . -name '*.py' -exec grep -nHr --color "$1" {} \; ; }
function grepcy() { find . -name '*.pyx' -exec grep -nHr --color "$1" {} \; ; }
To invoke them from IPython I invoke multiline bash:
In [6]: %%bash
...: . ~/.bash_profile
...: greppy triangle
...:
This runs the function correctly, but does not color the grep search term. I've noted as well:
In [10]: %%bash
....: source ~/.bash_profile
....: ls --color
....:
Colors output correctly, but invoking:
In [11]: %%bash
....: source ~/.bash_profile
....: la
Which is aliased to always use ls -a --color in my .bash_profile, does not.
One additional note that may be of use is that my .bash_profile also invokes dircolors to read a .dir_colors config that tweaks directory coloring for ls (to color py and pyx colors differently and to make .pyc colors relatively gray so that they're less visible). I'm not sure if there's an additional interaction.
I have a .bashsrc and IPython alias set up in an older (.ipythonrc alias) config on a work machine that colors correctly. I'm trying to get the same thing working on my MacBook Air for home use. This isn't a very important part of my whole ipython/bash/vim circle of Python development, but I'm picky enough about little details in my environments that I'd like to get it working if I can.
Kind of ugly, but if you're like me and really want to color the output, here's your best bet for bash and zsh (bonus):
zsh:
and you can define an alias to do it:
Hope this might be of help to someone else!