Last active
March 16, 2018 06:28
-
-
Save solidpple/b130c042bf8402ad152b6744facc7b52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /home/username/.ipython/profile_default/startup/alias.py | |
import subprocess | |
lines = subprocess.check_output('source bashrc; alias',shell=True).split(b'\n') | |
manager = get_ipython().alias_manager | |
for line in lines: | |
line = line.decode("utf-8") | |
split_index = line.find('=') | |
cmd = line[split_index+1:] | |
alias = line[:split_index] | |
cmd = cmd[1:-1] | |
print ("ALIAS:{}\t\tCMD:{}".format(alias,cmd)) | |
manager.soft_define_alias(alias, cmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment