How do you port your bash aliases to IPython version >= 0.11?
This question has already been answered for IPython < 0.11, and link for that is here:
h开发者_如何学编程ttp://ipython.scipy.org/Wiki/tips
Here is my solution. Improvements welcome!
In your ipython config, add the following lines: (mine is here: ~/.config/ipython/profile_default/ipython_config.py)
c = get_config()
## Port bash aliases to ipython
import os, string
a = os.popen("bash -l -c 'alias'").read()
a = a.translate(string.maketrans("=", ' '), '\'"').split('alias ')
a = [tuple(x.strip().split(' ', 1)) for x in a]
c.AliasManager.user_aliases = [x for x in a if len(x) == 2]
精彩评论