Reputation: 1944
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:
http://ipython.scipy.org/Wiki/tips
Upvotes: 3
Views: 680
Reputation: 1944
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]
Upvotes: 2