bash - How to use ~/.bashrc aliases on IPython 3.2.0? -
i need use aliases ~/.bashrc
on ipython.
first i've tried didn't work
%%bash source ~/.bashrc
according this post should
%%bash . ~/.bashrc f2py3 -v
it takes 20 sec run on jupiter , get:
bash: line 2: f2py3: command not found
my ~/.bashrc
file looks like
alias f2py3='$home/python/bin/f2py'
bash: line 2: type: f2py3: not found
neither alias, source, nor %rehashx% work
%%bash alias f2py3='$home/python/bin/f2py'
i found problem python, can't execute alias
command neither sh nor bash.
can use alias ipython magics?
you can parse bashrc file in ipython config , add custom aliases have defined:
import re import os.path c = get_config() open(os.path.expanduser('~/.bashrc')) bashrc: aliases = [] line in bashrc: if line.startswith('alias'): parts = re.match(r"""^alias (\w+)=(['"]?)(.+)\2$""", line.strip()) if parts: source, _, target = parts.groups() aliases.append((source, target)) c.aliasmanager.user_aliases = aliases
this should placed in ~/.ipython/profile_default/ipython_config.py
.
%rehashx
makes system commands available in alias table useful if want use ipython shell.
Comments
Post a Comment