开发者

How do you port bash aliases to ipython > 0.10?

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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜